Re: How to "Tell" a varible name
Re: How to "Tell" a varible name
- Subject: Re: How to "Tell" a varible name
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 07 Feb 2001 18:46:56 -0500
- Organization: [very little]
>
Date: Wed, 7 Feb 2001 14:45:32 -0800
>
To: email@hidden
>
From: SeaSoft Systems <email@hidden>
>
Subject: Re: How to "Tell" a varible name
>
>
At 13:04 -0800 2/7/2001, Marc K. Myers wrote:
>
>
>
>The problem is that at compile time AppleScript doesn't know which
>
>application's it should be looking at for the "inner meaning" of the
>
>commands. That's why this technique only works with commands that are
>
>common to all applications.
>
>
>
>What you need to do is simple, since the application will always be the
>
>same one.
>
>
>
>tell application file ID "WWW "
>
> [Do Stuff]
>
>end tell
>
>
>
>or
>
>
>
>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).
>
>
I had hopes that something simple like
>
>
>tell application file ID "WWW "
>
> [Do Stuff]
>
>end tell
>
>
would work, and was ecstatic to see this offered as a solution.
>
Sadly, it won't compile on my machine (OS8.6), even though an
>
application with the appropriate creator code is an active process.
>
Is there another syntax, perhaps within a finder tell block, that
>
might work?
>
>
It seems (to the newbie :-) like it should be a simple matter to
>
target a script to an application with known creator code, which App
>
is known to be up and running when the script is run, and is known to
>
be the *only* application with that code that is running, but I can't
>
get anything to work.
>
>
Any other thoughts?
This approach uses the "file" property of a process to get you a full
path to the file from which the process was launched:
tell application "Finder"
set wsFile to (file of some process whose creator type is "WWW ") as text
end tell
tell application wsFile
[Do Stuff]
end tell
Please let me know if this is successful.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[2/7/01 6:46:14 PM]