MacOS command line tool which executes OSA scripts (AppleScript, JavaScript, etc.)
Questions tagged [osascript]
267 questions
0
votes
2 answers
how can I echo something without newline with osascript in `run script` workflow in alfred?
I wrote some script in alfred workflow with osascript(js). As we known, console.log will left an undefined after echo the log to stdout, we could not use it to pass the result to the workflow outputs like clipboard. And then I found I can use eval…

chestnut
- 252
- 2
- 16
0
votes
1 answer
osascript set volume isn't working via ssh
here is my situation.
User A is currently logged on Computer A.
User B logs into Computer A via ssh.
User B runs via terminal a osascript (osascript -e 'set volume 0')
here is my error log:
Oct 20 13:25:17 osascript[29389] : Set a breakpoint…

James Dean
- 155
- 1
- 17
0
votes
1 answer
display notification no longer working in El Capitan
I have this function in my .zshrc for when I want to create a notification from a script in my shell:
notify() { osascript -e 'display notification "${*}"' }
The function just runs that one tiny line of applescript to create a notification with…

Dylan Karr
- 3,304
- 4
- 19
- 29
0
votes
1 answer
Possible to create new playlist on Spotify through terminal?
Found out that I am able to control Spotify through terminal from here
http://www.instructables.com/id/RFID-Controls-for-Spotify-on-OSX-using-hacked-Mir/?ALLSTEPS
for example skipping to the next song, you would type this in the terminal:
osascript…

Edwin Capel
- 11
- 1
- 2
0
votes
2 answers
Trouble formatting a string with multiple quotation marks
I am making a NSTask which runs osascript to gracefully quit an application instead of a killall/kill command.
I have this:
let killtask = NSTask()
killtask.launchPath = "/usr/bin/killall"
killtask.launchPath =…

DanTdd
- 342
- 3
- 10
0
votes
3 answers
IF statement doesn't work properly in osascript
I'm working on script which should do something if application is running or not Also there should be a timer of checking(60 seconds) The problem is that "if" statement which is checking "count" doesn't work.
Here is a script:
#!/bin/bash
osascript…

Serge
- 2,031
- 3
- 33
- 56
0
votes
1 answer
Check if app is running via bash in shell script
My "if" statement which is responsible for checking if app is running doesn't work. It's always returns "false"
Here is a script.sh:
#!/bin/bash
osascript -e "do shell script \"
if (ps aux | grep "[[S]kype]" > /dev/null)
then
…

Serge
- 2,031
- 3
- 33
- 56
0
votes
2 answers
osascript and sudo password entry
I am using osascript in a BASH script for dialog boxes on a MAC system. The problem I am having is several of the commands I need to use require privilages to function correct. If I use sudo in the BASH script, the password prompt shows in the…

Dennis Kerrisk
- 2,715
- 2
- 17
- 22
0
votes
1 answer
mac display-notification's icon
I write in nodejs
var exec = require('child_process').exec;
var pwd = 'osascript -e \'display notification "'+path.basename(des)+'" with title "'+ name + time +'"\''
exec(pwd, function (error, stdout, stderr) {
})
It comes…

Scorpio
- 25
- 6
0
votes
1 answer
Adding AppleScript/osascript to PATH
Very noob question, but couldn't find a decent answer.
Working with a command line plugin that requires adding AppleScript to my path, but honestly not sure what the right format is.
I know where the script is on my system.
$ which…

mhartington
- 6,905
- 4
- 40
- 75
0
votes
1 answer
How to tell mac OSX "osascript tell for "any device" set volume 0 ""
how to execute command in terminal to set volume for currect windows or application or any device.... For example to mute system vole it's simple :
osascript -e "set volume 1"
So, i got application witch aren't instaled only runing, i want to…

RepoStack
- 5
- 4
0
votes
1 answer
Passing variable from python to applescript
I'm trying to make a python script pass characters from a text file as keystrokes into OSX.
The text file is formatted as a column of characters:
Which is being read into a list (called lines). This bit seems to work, as when I type lines[3], for…

Alex
- 2,270
- 3
- 33
- 65
0
votes
1 answer
Buttons aren't functioning correctly with osascript
I have a dialog box that has two buttons, "OK" and "Cancel", I'd like to have the "OK" button launch a website, and the cancel button will stop the script. Right now both the "OK and "Cancel" buttons are launching the website. What am I missing…

Mojoscream
- 51
- 1
- 12
0
votes
1 answer
Setting popup box with osascript and a 10 second delay
I'm looking to setup a popup box for users to see that has a 10 second delay before it exits and the script continues. So far I've got the following.
osascript -e 'tell app "System Events" to display dialog with delay "10" "Running Health Check \r…

Mojoscream
- 51
- 1
- 12
0
votes
1 answer
Running osascript with bash -c
I'm working on a Sublime Text plugin (Python) and I have some shell scripts that are a part of it. Since Package Control gives you zipped packages, these scripts can't be run as files from within the zip, so I'm storing them as strings and running…

Chase
- 3
- 3