Re: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?
Re: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?
- Subject: Re: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?
- From: Shane Stanley <email@hidden>
- Date: Thu, 09 Sep 2010 09:12:40 +1000
- Thread-topic: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?
On 9/9/10 8:13 AM, "Dave Keck" <email@hidden> 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 <email@hidden>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden