Re: Tell Blocks Considered Harmful (was Re: open for access)
Re: Tell Blocks Considered Harmful (was Re: open for access)
- Subject: Re: Tell Blocks Considered Harmful (was Re: open for access)
- From: Rick Gordon <email@hidden>
- Date: Tue, 16 Dec 2008 21:05:30 -0800
On 12/16/08 at 4:36 AM -0800, Chris Page wrote in a message entitled
"Re: Tell Blocks Considered Harmful (was Re: open for access":
>Instead, I would probably write:
>
>tell application "Finder"
> set myFileName to name of my (choose file)
> set myFiles to every file of my (choose folder)
>end tell
------------------
That little snippet was a revelation to me -- that I could use "my" to effectively release the relationship of the application. But on a little further experimentation, I found that that code ...
tell application "Adobe InDesign CS3"
tell active document
-- ...
my display dialog "Boo!"
-- ...
end tell
end tell
... when run from Script Editor, still activates InDesign before displaying the dialog, while this code ...
tell application "Adobe InDesign CS3"
tell active document
-- ...
end tell
end tell
display dialog "Boo!"
tell application "Adobe InDesign CS3"
tell active document
-- ...
end tell
end tell
... opens the dialog in Script Editor (when run from within Script Editor).
I want to get the efficiency of not burdening the calling application with OSAX calls, and get the effect of the second snippet without the verbosity.
Why doesn't the first snippet work like the second, if the "my" pulls the scope out of the application domain?
--
___________________________________________________
RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________
WWW: http://www.shelterpub.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden