Hi Everyone,
I'm new to this list and pro-apps-dev in general so apologies in advance if the answer to my question is staring me in the face :D
I'm developing a plugin for FCP that creates some media (audio / visual) and an XML representation of it. I want to use an AppleEvent to tell FCP to load the media as a new project so that the user can use the media in their FCP project.
I want to allow the user to select an arbitrary (from Logic or something) XML file from their system and send it to FCP as described above. The method I've used *works* but FCP is very slow to react which leads me to believe I'm not doing things correctly. I have also looked at the example here but that didn't seem to work either.
Here's my code:
/** Select an XML file with an NSOpenPanel */
NSOpenPanel* openPanel = [NSOpenPanel openPanel]; NSArray* fileTypes = [NSArray arrayWithObject:@"xml"];
int result = [openPanel runModalForDirectory:NSHomeDirectory() file:nil types:fileTypes];
if (result == NSFileHandlingPanelOKButton) { NSString* xmlFileString = [[openPanel filenames] objectAtIndex:0]; NSURL* xmlFileURL = [NSURL fileURLWithPath: xmlFileString];
/** Create an AppleEvent based on the "apple_event" class from the "FCP_AE_Tester" example project supplied by Apple. */
apple_event* evt = [[apple_event alloc] init]; [evt create:kFCPOpenProjectFile class:kFCPEventClass dest:kFCPEventClass]; [evt sendAFile:[xmlFileString lastPathComponent] url:xmlFileURL key:kFCPProjectFileKey as:sendAsURL]; [evt send]; }
When I run the "FCP_AE_Tester" example FCP reacts immediately but when I use the same code in my FXPlug plugin it takes minutes.
Does anyone have any ideas why this is? Am I going about this the correct way?
Thank in advance! Best regards, ---- Frank |