Questions tagged [osascript]

MacOS command line tool which executes OSA scripts (AppleScript, JavaScript, etc.)

267 questions
2
votes
1 answer

applescript to osascript conversion?

I am using max msp to run shell commands, I have been prototyping code in applescript and need them to run in osascript for example - tell application "Google Chrome" to close tab 1 of window 1 converts to osascript -e 'tell application \"Google…
Rampartisan
  • 427
  • 6
  • 19
2
votes
1 answer

Java starting running command in new terminal (mac osx) - process builder not running osascript properly

I'm trying to create a new process in a new window. I'm following this example for the command Running a command in a new Mac OS X Terminal window (using Java Process builder). I printed out the resulting command and it works if I type it in…
Raekye
  • 5,081
  • 8
  • 49
  • 74
2
votes
1 answer

Launch cocoa application for all users during login

I want to launch myapp.app during login time and it should work for all users. I tried with osascript which launch only for a user who run that command . /usr/bin/osascript -e "tell application \"System Events\" to make a new login item with…
user12345
  • 425
  • 1
  • 3
  • 14
2
votes
1 answer

Why does my Applescript run in the Terminal using osascript on Snow Leopard but not on Lion?

I have the following Applescript which runs fine from the applescript editor in both Snow Leopard and Lion. I can also run it using osascript via terminal on Snow Leopard but not on Lion. The code is as follows tell application "System Events" try …
Christina
  • 43
  • 1
  • 6
2
votes
2 answers

PHP executing osascript differently from Terminal?

In my living room, I have a Mac Mini I using as both an HTPC as well as a home automation server. The software it uses for the automation is Shion, a free home automation app which is AppleScript capable. On that same Mac Mini, I'm running Apache…
1
vote
0 answers

osascript "display dialog" sometimes works and sometimes errors with "No user interaction allowed"

I have a small shell script running on my OSX 10.7 (Lion) macbook pro that uses osascript to gather input from the user. This script sometimes works perfectly, and sometimes returns execution error: System Events got an error: No user interaction…
1
vote
1 answer

Apple script in GitlabRunner failing Error code -600

I'm working on a project involving Apple Script and I can not manage to set it up correctly in the GitLab runner. No matter what I do it seems the gitlab-runner does not see any running applications, see following execution (Terminal is also…
Meru
  • 77
  • 13
1
vote
1 answer

Communicating with root child process launched with osascript "with administrator privileges"

How can I pass messages between a parent process that launches a child process as root using Apple Script and stdin/stdout? I'm writing an anti-forensics GUI application that needs to be able to do things that require root permissions on MacOS. For…
Michael Altfield
  • 2,083
  • 23
  • 39
1
vote
0 answers

Notifications via cron (MacOS)

I've got a script which disables Internet Sharing function on Macbook, then sends a GUI notification via osascript and an email. It works perfectly, but i don't get notifications when it run in cron. if [ "$(defaults read…
B0n3s
  • 31
  • 4
1
vote
1 answer

MacOS desktop background won’t change

I was playing around with a python script that downloads and changes the wallpaper, and suddenly the wallpaper went black and won’t change even through the preferences menu. The dock also stopped working and I am no longer able to switch apps using…
MeadMaker
  • 300
  • 1
  • 2
  • 6
1
vote
0 answers

osascript: can't open default scripting component

I run the following nodejs code to execute apple script: const {exec} = require('child_process') exec('osascript -e \'return "hello" \'', (err, stdout, stderr)=>{ if (err) return console.log(err); console.log(stdout); …
Froxcey
  • 51
  • 7
1
vote
1 answer

Defining osascript path with a variable

So I am trying to add a login item from the terminal and I am using this line: osascript -e 'tell application "System Events" to make login item at end with properties {path:/Users/me/Desktop/main, hidden:true}' But the thing is I want the main file…
Tanuj KS
  • 155
  • 2
  • 14
1
vote
0 answers

Using OsaScript to send Imessage without having a buddy ID

Can someone show me how I would be able to send a message to someone who I have not messaged using message previously. When I use the code below I get the error: execution error: Messages got an error: Can’t get buddy id "..." if I haven't messaged…
Doggy G
  • 31
  • 1
  • 4
1
vote
1 answer

osascript syntax error "Expected expression but found end of line. (-2741)"

I am writing a bash script that utilizes AppleScript that disables the microphone and camera, and then clicks the "Join now" button on the google meet webpage. The portion that disables the microphone and camera works perfectly, but I am running…
Keolai
  • 19
  • 1
  • 7
1
vote
1 answer

What app needs to be whitelisted in OSX's Security&Privacy Accessibility list, so that my bash script can send keystrokes?

I am writing a simple (haha) bash script that will send keystrokes to an app. It uses the osacript command line to do this, like so: osascript <
John O
  • 4,863
  • 8
  • 45
  • 78