Re: AppleScript bug in cocoa
Re: AppleScript bug in cocoa
- Subject: Re: AppleScript bug in cocoa
- From: Shawn Erickson <email@hidden>
- Date: Tue, 27 Dec 2005 20:55:02 -0800
On Dec 27, 2005, at 8:35 PM, Jean-Olivier Lanctôt wrote:
Hi,
In my app, I make extensive use of AppleScript (via NSAppleScript)
to communicate with iTunes. I have 10 scripts, located inside my
resources bundle.
The problem is that each time my app starts, it starts iTunes up if
it's not already running. I consider this to be a bug, since all my
apple scripts use this to make sure iTunes does not start up when
it's not running....
...snip...
I'm baffled. I don't know what to do and I depend on AppleScript.
I can't release an app that has this type of behavior.
Have you considered using what NSWorkspace provides for this type of
thing?
For example -launchedApplications[1] and checking for iTunes by name
or likely better by bundle identifier to avoid possible localization
issues (not sure if they come into play here). Also consider
monitoring for iTunes launching be listening for
NSWorkspaceDidLaunchApplicationNotification and
NSWorkspaceDidTerminateApplicationNotification notifications.
I have personally used this to understand if iTunes is running and
then to send it AppleEvents via simple AppleScript run from inside of
a Cocoa application.
-Shawn
[1] <
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSWorkspace.html#//apple_ref/occ/
instm/NSWorkspace/launchedApplications>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden