Re: How to "Tell" a varible name
Re: How to "Tell" a varible name
- Subject: Re: How to "Tell" a varible name
- From: email@hidden
- Date: Wed, 7 Feb 2001 21:10:26 -0500
On Wed, 7 Feb 2001 14:45:32 -0800, SeaSoft Systems <email@hidden> wrote,
>
>
>tell application "Webstar 4.4b2"
>
> tell application WebStar
>
> [Do Stuff]
>
> end tell
>
>end tell
>
>
>
>The commands will always go to an active process before they'd go to an
>
>application file, so the former syntax is probably what you need.
>
The problem I am having is that the version numbers of the
>
application I want to script are changing frequently (i.e., "Webstar
>
4.4b1", "Webstar 4.4b2", etc.) They all have the same creator code
>
and the same applescript dictionaries, but they are physically
>
different applications. I always want the script to target to
>
whichever one is running when the script fires, that is, the single
>
finder process whose creater code I have given "WWW*"
>
>
In this situation the "double tell" method seems to fail in general
>
since whichever version of the App was used at applet compile time
>
gets loaded when the script is run, in addition to the App version
>
that is actually running, which can be different. Having two versions
>
of the same app running at the same time creates a huge problem, as
>
you can imagine (it is a server in this case).
The problem with the example, which leads to the problem you noted of two
versions running, is that the inner "tell" block shouldn't be a string name, it
should be an application process. That is, you don't want
tell application WebStarNameString
you want
tell WebStarApp
You can start WebStar by its application ID, and then get the application itself
by telling the Finder,
tell application "Finder"
open application file id "WWW*"
set WebStarappName to name of result
--"WebStar Server 4.4b2"
set WebStarappProcess to application process WebStarappName as <<class
psn >>
--application "WebStar Server 4.4b2"
end tell
Note that in the above, <<class psn >> uses guillemets (chevrons,
option-shift-backslash and option-shift-backslash) and the "psn " is four
characters:
"pee ess en space". (The 'as class <<psn >>' is needed in OS 8 and 9, and not
used in System 7.)
Then your tell block should just say,
tell application "Webstar On Compiling Machine"
tell appProcess -- No "application"
Under MacOS 9, you can replace the first tell with
Using terms from application "...
Check Bill Cheeseman's advice in the AppleScript Sourcebook,
http://www.applescriptsourcebook.com/tips/launchbycreator.html
and
http://www.applescriptsourcebook.com/tips/tellbyvariable.html
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden