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: Thu, 18 Sep 2008 08:54:01 -0600
Great catch.
It appears to be working now after fixing that bug.
Thanks!
Tommy Schell
On Sep 17, 2008, at 5:43 PM, Helena Ju wrote:
Hi Tommy,
The following link has a description of how to turn on Apple Event
Logging to see what is going wrong:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleEvents/debugging_aepg/chapter_9_section_4.html
I think I also found a problem in your event creation (noted in-
line below)
Best luck,
Helena
On Sep 17, 2008, at 4:05 PM, Tommy Schell wrote:
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) );
I think this should be:
my_event.err = AECreateAppleEvent(my_class ,
eventType, &(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
_______________________________________________
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