On 9/9/10 8:13 AM, "Dave Keck" <davek...@gmail.com> wrote:

>> No, this is not correct. You can compile a script without launching
>> the target - at least on Snow Leopard.
> 
> I'm afraid my testing shows otherwise; on my system, the following
> code always launches Safari on both 10.5 and 10.6:
> 
>     [[[[NSAppleScript alloc] initWithSource: @"tell application id
> \"com.apple.Safari\" to activate"] autorelease] compileAndReturnError:
> nil];
> 
> (Note it's -compileAndReturnError:, not executeAndReturnError:.) The
> launching behavior seems to vary by application, though. For me, this
> code launches iSync, Safari and System Preferences, but doesn't seem
> to launch iTunes.
> 
> Such unpredictability is the nature of AppleScript

It's only unpredictable if you don't look for the reason.

It's a consequence of the fact that compilation requires an app's scripting
dictionary. For some apps the dictionary is fixed, but for others (for
example, those that support plug-ins) it can vary, in which case launching
the app is unavoidable.

-- 
Shane Stanley <sstan...@myriad-com.com.au>



_______________________________________________

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