Re: accessing Final Cut Pro Apple Events from Carbon
Re: accessing Final Cut Pro Apple Events from Carbon
- Subject: Re: accessing Final Cut Pro Apple Events from Carbon
- From: Tommy Schell <email@hidden>
- Date: Wed, 17 Sep 2008 17:05:38 -0600
Thanks for the reply.
I actually appear to get an error value of noErr from my AESend call,
but nothing happens in Final Cut.
If I do the same action from the sample code FinalCutPro_AppleEvents
(an attempt to open a project),
it opens no problem.
So in my Carbon code (which is actually a jni lib with a java
interface), I've extracted some code from the
Cocoa sample FinalCutPro_AppleEvents: (which, again, results in
noErr from AESend but nothing happens)
************************
the event struct:
struct apple_fcp_event {
AppleEvent theEvent;
AppleEvent theReplyEvent;
AEAddressDesc appAddr;
AEDescList paramList;
OSStatus err;
} my_event;
************************
initializing code:
// init event struct
AECreateDesc(typeNull, NULL, 0, &(my_event.appAddr));
AECreateDesc(typeNull, NULL, 0, &(my_event.theEvent));
AECreateDesc(typeNull, NULL, 0, &(my_event.theReplyEvent));
AECreateList(NULL, 0, false, &(my_event.paramList));
************************
// create event like so:
// create_event (kAEFCPOpenProjectFile);
void create_event (OSType eventType) {
OSType my_class = kFCPEventClass;
// create open project event
if (my_event.err == noErr) {
my_event.err = AECreateDesc(typeApplSignature,
&my_class, sizeof(OSType), &(my_event.appAddr) );
}
if (my_event.err == noErr) {
my_event.err = AECreateAppleEvent(eventType,
kFCPEventClass, &(my_event.appAddr) , kAutoGenerateReturnID,
kAnyTransactionID, &(my_event.theEvent) );
}
}
************************
// add a project file like so:
// CFStringRef x = CFSTR ( "/Users/tommyschell/myfoo.fcp");
// assign_project_file ( x ) ;
// pass in a posix style path (relative or absolute i think),
converted to url then fsref
void assign_project_file ( CFStringRef path) {
FSRef fileFSRef;
CFURLRef ref;
ref = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path,
kCFURLPOSIXPathStyle, false);
if (CFURLGetFSRef(ref, &fileFSRef))
{
my_event.err = AEPutParamPtr(&(my_event.theEvent) ,
kFCPProjectFileKey, typeFSRef, &fileFSRef, sizeof(FSRef));
}
}
************************
// send event
// ship it
if (my_event.err == noErr) {
my_event.err = AESend(&(my_event.theEvent), &
(my_event.theReplyEvent), kAEWaitReply, kAEHighPriority,
kAEDefaultTimeout, NULL, NULL);
}
************************
// clean up
void clean_up_event () {
// clean up
AEDisposeDesc(&(my_event.paramList) );
AEDisposeDesc(&(my_event.theReplyEvent) );
AEDisposeDesc(&(my_event.theEvent) );
AEDisposeDesc(&(my_event.appAddr) );
}
Can't get FCP to act, though it returns noErr.
Any ideas?
Thanks, Tommy Schell
On Sep 16, 2008, at 10:28 AM, Darrin Cardani wrote:
On Sep 16, 2008, at 9:02 AM, Tommy Schell wrote:
Can Final Cut Pro Apple events be used in Carbon?
I can't seem to get FCP to respond from Carbon code. I extracted
the necessary code
from the Cocoa sample FinalCutPro_AppleEvents over to Carbon but
now it doesn't work.
Yes, FCP Apple Events can be used in Carbon. The OS shouldn't care
what libraries a given app links against when using Apple Events.
You might want to post a snippet of code and what error values
you're getting back.
Darrin
--
Darrin Cardani
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden