Re: Scripting Additions Calls in Tell Blocks
Re: Scripting Additions Calls in Tell Blocks
- Subject: Re: Scripting Additions Calls in Tell Blocks
- From: Gary Lists <email@hidden>
- Date: Mon, 09 Feb 2004 23:32:36 -0500
Michael Terry wrote [2/9/04 7:34 PM]:
>
However, now it seems to me that calling additions in tell blocks isn't
>
as harmless has been made out. I didn't know that scripting additions
>
could be aware of their context, but note:
<clipped>
>
open location "http://www.google.com/"
>
--> ".014 secs"
>
>
tell application "Safari"
>
open location "http://www.google.com/"
>
end tell
>
--> ".405 secs"
My non-engineering mind seems to think that this makes sense, as it isn't
the shortest trip possible. Safari gets the call, fumbles a bit, can't make
heads nor tails, then laterals to the next bloke.
I gave a quick look at ASTDG, and beginning on page 333 there is some
related discussion [1].
The author points out:
"One of the main reasons for using scripting additions is speed [over
straight AS code]." and
"Just how quickly a scripting addition is called though, depends on how you
call it. The osax architecture is such that a scripting addition appears to
be present 'inside' whatever application is being targeted when the
scripting addition command is called."
He goes on to describe the slow-down, with the command being dealt with
(unsuccessfully) by the targeted application and then being passed along
when no entry is found in the dictionary.
When you think about it, there is really no need to tell _Safari_ to 'open
location', is there?
--
Gary
[1] AppleScript: The Definitive Guide; Matt Neuburg; O'Reilly
_______________________________________________
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.