Re: Quit iTunes
Re: Quit iTunes
- Subject: Re: Quit iTunes
- From: "Mr. Gecko" <email@hidden>
- Date: Sat, 24 May 2008 14:53:51 -0500
Thank you so much it works.
On May 24, 2008, at 2:38 PM, has wrote:
Mr. Gecko wrote:
How would I quit iTunes. There is a way to launch it with
NSWorkspace but how about quit?
Send a quit AppleEvent
How would I do that?
I have been looking for a while and I found aevtquit but I can't find
out how to send.
Example:
#include <Carbon/Carbon.h>
OSStatus QuitApplication(char *bundleID) {
AppleEvent evt, res;
OSStatus err;
err = AEBuildAppleEvent(kCoreEventClass, kAEQuitApplication,
typeApplicationBundleID,
bundleID, strlen(bundleID),
kAutoGenerateReturnID,
kAnyTransactionID,
&evt, NULL, "");
if (err == noErr) {
err = AESendMessage(&evt, &res, kAENoReply, kAEDefaultTimeout);
AEDisposeDesc(&evt);
}
return err;
}
int main (int argc, const char * argv[]) {
return QuitApplication("com.apple.itunes");
}
For anything more complex, use a high-level bridge (e.g. see my sig).
HTH
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
_______________________________________________
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