Re: Now is: Finder tell block
Re: Now is: Finder tell block
- Subject: Re: Now is: Finder tell block
- From: "J. B Stewart" <email@hidden>
- Date: Sun, 03 Mar 2002 13:11:50 -0500
Since no one else has really posted a really graphic example of why it's a
good idea to be careful about what you wrap a "tell" block around try these
yourself. I'm using OS 10.1.3 AS 1.8.2b1 but they will work in prior
systems.
-- script start
path to desktop
-- script end
--> alias "OSX:Users:john:Desktop:"
-- script start
tell application "Finder"
path to desktop
end tell
-- script end
--> Finder got an error: Can't make desktop into a item.
The second really good reason not to use unnecessary tells is execution
time. When you use a tell wrapper you send all the commands it encloses to
the subject of the tell, even if the command being sent isn't part of its
command set. The application being "told" will check every command in it's
suite to see if it is there before sending it up the pipe to AppleScript or
to a Scripting Addition (assuming it doesn't error as above). This can
consume a lot of processor cycles especially if the tell is inside recursive
code.
Placing a tell within another tell adds yet another layer of commands to
check out before you can execute at the "proper" layer. While I agree that
this can sometimes be used to prevent conflicts I would recommend using
other methods instead, raw codes are so much cheaper and efficient in
execution.
John
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.