Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I launch an Automator application using AppleScript?

Tags:

applescript

I am trying to use Remote Buddy to control Photo Booth, but I need a way to switch between Still and Video modes, my solution to this was to use an Automator app to select one or other of the two radio buttons when a remote button is pressed.

I've created the .app, and it works fine when I double click it from the desktop, but I need a way to launch the .app from within Remote Buddy, and AppleScript seems to be my only option.

tl;dr

I need to be able to launch an Automator .app file using AppleScript, but can't figure out the correct syntax.

like image 577
beeglebug Avatar asked Oct 17 '11 10:10

beeglebug


2 Answers

If I made an Automator app named Untitled I would start it by using this command tell application "Untitled" to activate

Once you create an application using one of the following methods, that application can be accessed in any other script via its name. It's defined globally, as is any other application on your mac. Just use the tell application "app Name"

Two ways of creating an application : Using AppleScriptUsing automator

like image 73
Kassym Dorsel Avatar answered Oct 21 '22 08:10

Kassym Dorsel


activate app ((system attribute "HOME") & "/Desktop/test.app/")

You could also use the automator shell command.

automator test.workflow
automator test.app
automator test.workflow -v # verbose
automator -i lol test.workflow
echo lol | automator -i - test.workflow
automator -i $'lol\nlol2' test.workflow # \n separates input strings
automator -d somevar=somevalue test.workflow
like image 44
Lri Avatar answered Oct 21 '22 07:10

Lri