Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How do I send Apple Events from Cocoa to Carbon?

How do I send Apple Events from Cocoa to Carbon?
Thread Tools
Mac Elite
Join Date: Oct 2000
Location: Edinburgh, Scotland
Status: Offline
Reply With Quote
Apr 5, 2001, 07:33 PM
 
Is there any way to send an application (iTunes) an AppleEvent from cocoa objective-c code?

What I'm trying to do is make a dockling to tell iTunes to play, pause etc. I can do it in AppleScript, but the derived applications take longer to startup than it takes me to change to iTunes and press a key on my keyboard!

The dockling bit works fine, but I can't find any info relating to Apple Events in the developer COCOA documentation. It's there for carbon, but not cocoa.

The events as can be used in AppleScript are:
tell application "iTunes"
«event hookPlay»
«event hookPaus»
«event hookStop»
«event hookNext»
«event hookPrev»
end tell

Oh yeah, the other problem is I've never done anything with AppleEvents before so I'm not sure what is involved, probably just creating the event and sending it but I don't even know how to do that!

Cheers

------------------
Shh! Be vewy, vewy qwiewet! I'm hunting wuntime ewwors
ClamXav - the free virus scanner for Mac OS X | Geobunny learns to fly
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 6, 2001, 01:45 PM
 
There is SOME documentation... http://developer.apple.com/techpubs/...ntManager.html

But it's not really very good...

For example...

- (OSErr)dispatchRawAppleEventconst AppleEvent *)theAppleEvent
withRawReplyAppleEvent *)theReply
handlerRefConUInt32)handlerRefcon

Looks like you might need to create an AppleEvent structure or something. The documentation for that would probably be in Carbon.framework... if you ever figure it out, post back to tell me!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2