Re: tell block targets
Re: tell block targets
- Subject: Re: tell block targets
- From: Jon Pugh <email@hidden>
- Date: Sat, 03 Dec 2011 23:06:27 -0800
On Dec 3, 2011, at 7:21 PM, Alex Zavatone wrote:
> Well, that would depend on how the AS command router handles the dispatching.
>
> In some cases, this context switching matters.
AppleScript doesn't really do any "context switching" per se.
There's really only two kinds of statements in AppleScript. Ones which are handled purely by AppleScript and ones which send AppleEvents.
Tell statements only affect AppleEvents, and only by setting the target attribute of the AppleEvent. Additionally, the AppleEvent manager is smart enough to short circuit AppleEvents sent to the current process so that they just go directly to the appropriate handler, but AppleScript doesn't know anything about that. When ApleScript does send an AppleEvent, the system handles all the process switching. AppleScript is unconcerned with all that.
So Shane is (as usual) entirely correct. There's no difference between a single tell and multiple tells. Personally, I prefer keeping my tell blocks as small as I can so that I know extra events, like scripting additions, aren't accidentally sent to other processes since they're both safer and faster when sent to the current process (whichever one is running the script).
Most script running utilities have their own process they run the scripts from. They also typically support Command-Period to stop run-away scripts, though you'll need to bring them to the front in order to get the keystrokes to the proper process. Their process names will generally correspond to their file name. I prefer utilities with some UI and a dock icon for this reason. I use DragThing to run most of my scripts these days, though I also use Apple's script menu for some stuff.
Jon
_______________________________________________
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