Questions tagged [osascript]

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

267 questions
1
vote
1 answer

Passing a new function to a osascript command

I have function to change the title of a terminal. I wish to pass this to a osascript command. I try: function title { name=hostname printf "\033]0;$name %s\007" "$1" } osascript -e "tell application \"Terminal\"" \ -e "tell application…
Breako Breako
  • 6,353
  • 14
  • 40
  • 59
1
vote
1 answer

Bash issues with osascript GUI commands

I am trying to automate the process of launching an application in OSX and typing an administrator password at a security agent prompt. I was hoping to avoid the use of AppleScript GUI scripting however the underlying cause of the admin prompt is so…
Tim
  • 3,091
  • 9
  • 48
  • 64
1
vote
1 answer

Inline apple script

I need to write the following script inline tell app "Spotify Queue" addTrack "spotify:track:7sa1xOgT1c8xQfbSL5FrCe" end tell like this one sh('osascript -e \'tell app "Spotify" to playpause\'') but I can't get it right.
marcus
  • 9,616
  • 9
  • 58
  • 108
1
vote
2 answers

Why does a bash script continue running even though a dialog box is displayed on the screen waiting for an input from the user?

I have a bash script I'm using on Mac OS X (X.5 thru X.8) machines. In it is a dialog situation asking to continue the script by pressing "OK" or letting the script snooze by pressing "snooze". That part is working. However, I was testing the…
1
vote
1 answer

How do I convert this AppleScript to osascript?

I have written an AppleScript and want to convert it to an osascript so I can run it on launch using launchd. Is there any way I can convert this to osascript or do I have to rewrite the whole script as an osascript? If it can't be done is there at…
Aldini10
  • 11
  • 2
1
vote
1 answer

How can I edit itunes song lyrics from the terminal?

I can get the lyrics using: osascript -e '''tell application "iTunes" to lyrics of the current track''' but how can I set them? I'm trying to make corrections to the current lyrics using my text editor.
1
vote
2 answers

Fixing osascript clipboard for OSX Mountain Lion

In my Ruby application, I've used the following function for a long time to write to the clipboard: def pbcopy(text) IO.popen("osascript -e 'set the clipboard to do shell script \"cat\"'","w+") {|pipe| pipe << text} end I got this code from here,…
Stian Håklev
  • 1,240
  • 2
  • 14
  • 26
1
vote
1 answer

Multiline textbox in OSAScript

I am wanting to edit the TestFlightApp archive script so that when it prompts for release notes it will be a bigger textbox than just one line. Right now it displays the size of one line but will allow me to press CTRL+J to add multiple…
Bot
  • 11,868
  • 11
  • 75
  • 131
0
votes
0 answers

Osascript Music get current track shareable url

Is there a way to get the shareable URL for the current track playing via osascript? For instance: https://music.apple.com/br/album/never-gonna-give-you-up/1558533900?i=1558534271&l=en-GB Thanks in advance I tried get the properties tell application…
0
votes
1 answer

AppleScript handlers with whitespace in parameter names and without "given"

I read about interleaved- handlers and parameters in handlers in Apple's documentation, but I don't know why some specific open-source code is working for others while not for me. In the documentation of Handlers with Labeled Parameters it declares…
Cocktail
  • 19
  • 5
0
votes
0 answers

ZSH osascript tell parent application (process) display dialog

I have an AppleScript application that runs a do shell script of my script.sh in the application package. That my script.sh does some interaction with the user through $osascript -e 'tell me to button returned of (display dialog "blabla.Do you want…
Greg
  • 33
  • 6
0
votes
0 answers

How to use osascript to open Iterm2 and run script?

Currently, I have an sh file which I use to run a script as such: osascript -e "tell application \"Terminal\" to do script \"cd $PWD && npm run build:watch\"" osascript -e "tell application \"Terminal\" to do script \"cd $PWD && firebase…
Owenn
  • 638
  • 1
  • 6
  • 23
0
votes
1 answer

Tauri - Run bash Script - Example

I'm new to Tauri and Rust in general. I'm working on this desktop app that will run different bash commands such as: returning some outputs open a new window (terminal) to run a process with output value I'm not entirely sure how to best make it…
0
votes
1 answer

Is it possible to monitor incoming calls on a connected iPhone and send automated responses via a Mac app?

I need to include in my app a way to monitor whenever an incoming call takes place, which won't be answered by anyone; and then send a customized automated response to the caller using Messages app. The app runs on the Mac and every user has their…
Serch
  • 3
  • 1
0
votes
0 answers

Opening a dialogue from the terminal

I've been struggling trying to open an alert popup to MacOs users using the terminal. The script is been ran using an MDM solution, so I need to check which user is active before running it. I tried using the following script, it does succeed…