10 Replies Latest reply: Jun 20, 2010 7:09 AM by Stefan Bracke
Stefan Bracke Level 1 Level 1 (5 points)
I am working on a system integration based on Final Cut Server.

I want to launch Final Cut Pro on the server machine which would open a project and export sequences found in a certain bin.

I am a ruby(cocoa) fan and fond of rb-appscript.

Just imagine this:

require 'appscript'
include Appscript

app = app("Final Cut Pro")
project = app.current_project.get
exportbin = project.bins["EXPORTME"]
exportbin.sequences.each | asequence | do
asequence.export
end

(or similar in Applescript)
Anyone have an idea if i am really dreaming or this is feasible? Ever?

MacPro 8 core , MacBook Pro, MacMini, AppleTV, iPhone 3G, Mac OS X (10.6.1), I love Cocoa and Ruby!
  • 1. Re: Applescriptable / AppleEvents
    Studio X Level 7 Level 7 (26,940 points)
    FCP doesn't support apple script (or so I've been told by those who should know).

    x
  • 2. Re: Applescriptable / AppleEvents
    Stefan Bracke Level 1 Level 1 (5 points)
    That must be a mistake? Apple would never ship an application of this type without Applescript support. (Yeah right...)

    I thought it supported Apple Events...
  • 3. Re: Applescriptable / AppleEvents
    Kevin Brock Level 4 Level 4 (2,380 points)
    I have done some very very simple scripting with FCP using "System Events". So yes, some minor scripting is possible. But unlike most apps out there, if you launch the Script Editor "library" you will NOT see FCP in the list.
  • 4. Re: Applescriptable / AppleEvents
    David Bogie Chq-1 Level 7 Level 7 (24,700 points)
    sorry, butting in, might not be applicable. There's a bunch of stuff you can ask Compressor to do before and after some chores, most of the tasks are prebuilt events. Implies you can Applescript it to your heart's content.
    Opening and searching FCP by remote for something like a watch folder is not possible.

    What was the question?

    bogiesan
  • 5. Re: Applescriptable / AppleEvents
    David Bogie Chq-1 Level 7 Level 7 (24,700 points)
    Stefan Bracke wrote:
    I am working on a system integration based on Final Cut Server.I want to launch Final Cut Pro on the server machine which would open a project and export sequences found in a certain bin.


    This statement doesn't mean much to video people. Tell us what the purpose of your script would be, what problem does it solve for you. We may have a better solution.

    Stefan Bracke wrote:
    I am a ruby(cocoa) fan and fond of rb-appscript.


    I a great fan of NEF, Zeis, .aep, and .motn. Do those ring a bell with you?

    Stefan Bracke wrote:
    Just imagine this:


    Unfortunately, no, I cannot imagine that.

    bogiesan
  • 6. Re: Applescriptable / AppleEvents
    Stefan Bracke Level 1 Level 1 (5 points)
    Purpose:
    A central FCS holds all the highres media and FCP projects. Editors can check assets out and in , using proxy media.
    Upon a trigger (change in a metafield like status) FCS launches FCP , opens the project, looks for sequences in a specific bin, exports them using highres assets and the default export settings (for example). In short, editors are not required to render the said sequence in all their glory themselves

    I am a great fan of .motn too! Maybe we can share some deeper thoughts on it!
  • 8. Re: Applescriptable / AppleEvents
    Stefan Bracke Level 1 Level 1 (5 points)
    Thanks Andy , that's very useful information.
  • 9. Re: Applescriptable / AppleEvents
    hhas Level 2 Level 2 (190 points)
    The problem with FCP is that while it does support Apple events (though doesn't provide a dictionary to translate the raw AE codes to human-readable terminology), event handlers that return results do so in completely non-standard fashion. While every other AE-aware app in existence identifies return values by keyAEResult, which AppleScript and every other bridge understands, FCP uses kFCPXMLDataKey. That means that while you can send events to FCP from AppleScript (using AS's raw 'chevron' syntax), AS looks for return values under keyAEResult so will never return any results.

    (BTW, the FCP developers could trivially fix this without breaking backwards compatibility just by packing return values into the reply event twice, once under kFCPXMLDataKey, and again under keyAEResult. Feel free to file a bug report/feature request on this.)


    With rb-appscript, you need to use the lower-level AEM API to send events to applications that don't have a dictionary. When dealing with FCP, you also need to bypass AEM's standard Send::Event#send method dispatch the event via AE::AEDesc#send and unpack the reply event yourself (Codecs#unpack should do it).

    (Note that the appscript/AEM docs don't really go down to the AE level, but the AE extension is just a thin wrapper around the Carbon Apple Event Manager APIs so go read Apple's docs for that.)

    e.g. See this thread on the rb-appscript mailing list for more details:

    http://rubyforge.org/pipermail/rb-appscript-discuss/2009-December/000318.html

    Another option might be to repackage Apple's existing ObjC class wrapper as a framework, which you can then access via RubyCocoa/MacRuby. The code for that is here:

    http://developer.apple.com/mac/library/samplecode/FinalCutPro_AppleEvents
  • 10. Re: Applescriptable / AppleEvents
    Stefan Bracke Level 1 Level 1 (5 points)
    From the bits and bobs I found googling, I found some jewels of information too. But your reply , hhas, is the most valuable of them all. Thanks a million!

    Hopefully, the FCP dev team reads the feedback I send them (thru the Apple site). I even refrained from using any harsh words...