I should mention that we added a bunch of error checking to make the Apple Events much more robust in FCP 7, so things that used to not work will work in FCP 7 even if you technically don't follow the documented path.
-Helena On 2010-02-22, at 11:59 AM, Tim Jones wrote: Not to discount your answer, Eryk, but I'm interested in a bit more info here than simply it should work if you do it correctly. As Brad's indicated, his method - whether right or wrong - works with the latest and greatest but fails with an unexpected result in 6 and 5. Personally, I only have a need to read XML from FCP so I've not run into this, but it does lead one to wonder what changed that would allow an incorrect XML event to work in the new generation.
TIm On Feb 22, 2010, at 12:38 PM, Eryk Vershen wrote: The example code works just fine. I just downloaded it and tried it.
Some people get tripped up - expecting that should give it the name of an XML document - you don't. You open the XML document in the test application and when you run a sendXML it will send the contents of the frontmost document. It works this way to make it easy to get XML from FCP, modify it and send it back.
I feel certain there is something wrong with the actual bytes being sent by your app. Plenty of developers have used this functionality without reporting the issue you describe. Please turn on AppleEvent tracing and verify that the characters being are actually correct.
-eryk
On Feb 22, 2010, at 9:56 AM, Brad Wright wrote:
Hi Eryk:
Yes, I tried to use the example code, but it would not send an XML file to Final Cut Pro. It didn't work and I didn't want to modify the example code. The interesting thing is that the code below works fine with Final Cut Pro 7.0, but in Final Cut Pro 6.0 and 5.0 it asks for a DTD. So the Apple Events are getting sent, but version 5.0 and 6.0 want a DTD. Importing the same XML file rather than sending it, will work with FCP 5.0, FCP 6.0, FCP 7.0. Sending the XML file to 5.0 and 6.0 won't work.
Brad On Feb 22, 2010, at 9:07 AM, Eryk Vershen wrote: I believe Helena was suggesting that you use the sample app to verify that sending the text of your XML worked fine.
I expect your problem is the method XMLData returns an NSData object which contains an NSString. I don't have the text of your sendXML method, but is it extracting the bytes of the contained NSString and attaching them to the event?
Have you tried turning on AppleEvent tracing so you can see what you are actually sending?
regards, -eryk
On Feb 21, 2010, at 9:53 PM, Brad Wright wrote: I can't get the FinalCutPro_AppleEvents sample code to load an XML file and send it to FCP. I'm using the following calls which work in 7.0, but not in FCP 5.1.4. Haven't tried 6.0, but I will try that next.
-(void) sendToFinalCutPro:(NSXMLDocument*) newTreeRoot { apple_event *sendEvent = [[apple_event alloc] init]; NSData *finalData = [newTreeRoot XMLData]; [sendEvent launchFinalCutPro];// I added this one, so don't worry about it. [sendEvent create:kAEImportXMLToDocument // Event: open a project file class:kFCPEventClass // Class: FCP Events dest:kFCPEventClass]; // Destination: FCP Events [sendEvent sendXML:finalData]; // attach the XML Data
// send the event [sendEvent send];
}
On Feb 21, 2010, at 9:24 PM, Helena Ju wrote: Brad,
And change the event popup to 'sendXML' and plug your XML file in there and make sure you get the same result.
Another possibility is that the XML translation file is missing in your FCP 5 installation, but then importing the file should never work in that application, regardless of how you send it along.
Cheers, Helena On Feb 21, 2010, at 2:40 PM, Brad Wright wrote:
Does anyone know why I can import an XML file into FCP 5, but it refuses to import when I send it to Final Cut Pro via the events. I'm generating an XML file from my application and FCP 5 doesn't like it when I send it via an event. If I use the import XML command in FCP 5.0 it's fine. FCP 7 works fine for both, but not FCP 5.0. FCP 5 keeps asking for a translation document even though I'm setting it up as an xmeml 1.0 doc.
_______________________________________________
Tim -- Tim Jones
Remember: Amateurs...built the ark. Professionals...built the Titanic
_______________________________________________
|