FROM : Mr. Gecko
DATE : Sat May 24 21:53:51 2008
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
>
DATE : Sat May 24 21:53:51 2008
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
>
| Related mails | Author | Date |
|---|---|---|
| Mr. Gecko | May 24, 17:49 | |
| Tommy Nordgren | May 24, 18:13 | |
| Mr. Gecko | May 24, 18:33 | |
| I. Savant | May 24, 18:43 | |
| Tommy Nordgren | May 24, 21:23 | |
| has | May 24, 21:38 | |
| Mr. Gecko | May 24, 21:43 | |
| Mr. Gecko | May 24, 21:53 | |
| Daniel Dickison | May 24, 22:53 | |
| Gregory Weston | May 25, 01:45 | |
| Uli Kusterer | May 26, 00:26 |






Cocoa mail archive

