Monday, December 11, 2017

#1 2002-02-14 11:51:23 am

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

Stopping script from asking for non-existent app

Is there a way to prevent a script from asking for the location of an application the user does not have?
The Moa Tunes project I'm working on will use Entourage X and Eudora X if available. I have all calls to these apps in If ... then blocks which only execute if the user choses to use these features. But the script asks for the location of these applications on launch anyway.
If a tell command to the app is executed, then it would make sense to ask for the location, but if that tell block is never reached?
Is there a work around?
Thanks.


One mans trash is another mans treasure

Offline

 

#2 2002-02-14 12:43:03 pm

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

Re: Stopping script from asking for non-existent app

: Is there a way to prevent a script from asking for the location
: of an application the user does not have?

: The Moa Tunes project I'm working on will use Entourage X and
: Eudora X if available. I have all calls to these apps in If
: ... then blocks which only execute if the user choses to use
: these features. But the script asks for the location of these
: applications on launch anyway.

: If a tell command to the app is executed, then it would make
: sense to ask for the location, but if that tell block is never
: reached?

: Is there a work around?

The compiler needs to use the dictionary from each application in order to compile commands directed to it.  If it can't find the application it can't compile.  At run time it assumes it needs each of these applications in order to run.

The workaround it the "using terms from" command that allows you to use a variable name instead of the actual application name in the tell statement.  In older versions of AppleScript that don't have "using terms from" there is a "double tell" technique that does the same thing.  You can find details about this on Bill Cheeseman's AppleScript Sourcebook site.
Marc K. Myers
Marc@AppleScriptsToGo.com
AppleScriptsToGo
4020 W.220th St.
Fairview Park, OH  44126
(440) 331-1074

[02/14/2002  12:41:59 PM]


One mans trash is another mans treasure

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)