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 15:17:47 -0500
- Organization: [very little]
>
Date: Wed, 7 Feb 2001 08:33:12 -0800
>
To: email@hidden
>
From: SeaSoft Systems <email@hidden>
>
Subject: How to "Tell" a varible name
>
>
I am having problems getting a simple "Tell application" task to work
>
using a variable Tell target. Sorry if this has come up before...
>
>
For example, this issues no error but fails to work properly
>
>
tell application "Finder"
>
get name of (the first process whose creator type is "WWW ")
>
end tell
>
>
set WebStar to result as text
>
Display dialog Webstar
>
--> Webstar 4.4b2
>
tell application WebStar
>
Display dialog "Inside Tell" -- To see if we actually get into the Tell
>
--> Inside Tell
>
>
Do stuff
>
-- Fails to do stuff, no error messages
>
>
on error errMsg number errNum
>
error number errNum
>
end tell
>
>
While this works as expected, again without errors
>
>
tell application "Webstar 4.4b2"
>
Display dialog "Inside Tell"
>
--> Inside Tell
>
>
Do stuff
>
-- Does stuff just fine
>
>
on error errMsg number errNum
>
error number errNum
>
end tell
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.
[Thank you Mr. Cheeseman!]
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[2/7/01 3:10:37 PM]