Wednesday, April 16, 2014

#1 2012-12-07 06:40:16 am

cirno
Member
Registered: 2005-05-30
Posts: 448

Correct way to open AppleScript?

What is correct way to run AppleScript from another AppleScript?

There is atleast run, launch and open and this confuses me.

Offline

 

#2 2012-12-07 06:50:06 am

alastor933
Member
From: Utrecht, NL
Registered: 2008-09-12
Posts: 419

Re: Correct way to open AppleScript?

Applescript:

do shell script "osascript -e 'say \"Hello\"'"

lol

There is no "correct" way, I think. You select what you're comfortable with, or what is fastest.
A matter of style, so to speak.
That's assuming the end result is the same for each command - which may not be the case.
I never had need to figure that out.

Last edited by alastor933 (2012-12-07 06:53:43 am)

Offline

 

#3 2012-12-07 07:03:39 am

cirno
Member
Registered: 2005-05-30
Posts: 448

Re: Correct way to open AppleScript?

Thanks, but i mean launch AppleScript application. For instance:

Applescript:

tell application "testing" to run

Offline

 

#4 2012-12-07 07:15:41 am

McUsrII
Member
Registered: 2012-11-20
Posts: 2254
Website

Re: Correct way to open AppleScript?

Applescript:

tell application "testing" to run

Makes it come to the foreground.

Applescript:

tell application "testing" to launch

Starts it up in the background, ready to take requests.

You can also tell it to open in the background with the open -g command, if you have set CFBundleSignature in the plist.file of your applet. You can also open it directly with a open -a command within a do shell script.

Type man open in a Terminal window.


Filed under: Application, open, run

Offline

 

#5 2012-12-07 07:22:47 am

mouramartins
Member
From: Algarve
Registered: 2010-11-21
Posts: 115

Re: Correct way to open AppleScript?

Launch does not send the run command. Open behaves more or less as run.

Offline

 

#6 2012-12-07 07:41:55 am

McUsrII
Member
Registered: 2012-11-20
Posts: 2254
Website

Re: Correct way to open AppleScript?

I wrote:

Applescript:

Open this Scriplet in your Editor:
tell application "testing" to launch

Starts it up in the background, ready to take requests.

I really meant that it wasn't full launched, but ready to run. It is per definition, started up, it just hasn't run yet.

Activate, I think, is like an implicit run.

And the fun part, is that if you have handlers indside your app, then you can call those within a tell block of the app, and pass it messages. smile

Last edited by McUsrII (2012-12-07 07:42:16 am)


Filed under: message, run, launch, Activate

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.110 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)