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: Chris Page <email@hidden>
- Date: Fri, 19 Dec 2008 17:47:49 -0800
On Dec 19, 2008, at 4:09 AM, Rick Gordon wrote:
So, Chris, then please confirm that the code in sample 1 below (with
multiple commands sent to "me," but nested inside an application
call) -- as the skeleton of something much more complex -- would
avoid your potential issues as well as the version in sample 2.
Thanks.
Yes, the nested ‘tell me to’ block in #1 avoids sending the commands
to Finder. Moving the commands outside the Finder tell block
altogether, as in #2, is even better, because it eliminates
dependencies on Finder's terminology altogether, and makes it clear to
anyone reading the code that you don't intend it to use Finder's
terminology for those lines.
--SAMPLE 1
tell application "Finder.app"
--blah blah
--blah blah
tell me
set theDate to (do shell script "date")
display dialog "Hi, the date is " & theDate
end tell
--blah blah
--blah blah
end tell
--SAMPLE 2
tell application "Finder.app"
--blah blah
--blah blah
end tell
set theDate to (do shell script "date")
display dialog "Hi, the date is " & theDate
tell application "Finder.app"
--blah blah
--blah blah
end tell
--
Chris Page
The other, other AppleScript Chris
_______________________________________________
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