On Jun 26, 2011, at 6:09 AM, Bill Cheeseman wrote:
> 
> On Jun 25, 2011, at 7:52 PM, Andy Lee wrote:
> 
>> get application id "com.yourcompany.TrivialScriptable"
>> set myApp to result
>> tell myApp
> 
> 
> It has been true since the beginning of time (1993) that you cannot 'tell' a 
> variable but must instead 'tell' the application, at least in most cases. 
> It's one of the reasons why us old timers think of AppleScript as a "trial 
> and error" language. You have to learn many of the rules by doing, not by 
> reading the manual.

I gathered as much from the "Scope of This Book" chapter of Matt Neuburg's book.

> I wrote this particular issue up at length many years ago in two old articles 
> that are still available on The AppleScript Sourcebook at 
> <http://macscripter.net/viewtopic.php?id=24570> and 
> <http://macscripter.net/viewtopic.php?id=24569>. Some of what I wrote then is 
> no longer completely true, thanks to the ongoing evolution of AppleScript.

I almost stumbled across the "double-tell" technique. In one of my iterations I 
used the bundle id to activate the app, then used the name in a separate tell 
block to send my custom command. It didn't occur to me to nest the tells.

The "double-tell" reminds me of casting an Objective-C variable to get rid of a 
compiler warning, when you know that the method you're calling will be found at 
runtime. The "compiler warning" in AppleScript is when you save or run the 
script and a command name doesn't turn bold.

Thanks, Bill!

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to