Thursday, May 28, 2020

#1 2009-02-18 02:35:03 am

jaspersiegers
Member
From:: The Netherlands
Registered: 2006-08-30
Posts: 48

How to AppleScript FInal Cut Pro using Apple Events?

Hi,

I know it's not possible to applescript Final Cut Pro.
However it is possible to talk to Final Cut Pro, or FCP, through Apple Events.
http://developer.apple.com/samplecode/F … index.html
However that is all obj-c and I'm not very good in that wink

Since Apple Events are used by AppleScript with most scriptable applications I was wondering if there was a way to applescript FCP.
All I need is to automate is for FCP to export an XML of an fcp project file.

Is this possible?

Thanks in advance.

Jasper


Filed under: fcp, Final, Cut, Pro

Offline

 

#2 2009-02-19 09:50:10 am

Matt-Boy
Member
Registered: 2005-10-21
Posts: 480

Re: How to AppleScript FInal Cut Pro using Apple Events?

Usually, you can script anything with System Events that you can manually do by selecting from a menu or hitting a keystroke. Getting the syntax right for menu selections is usually pretty difficult. If the export command you are trying to automate has a keyboard shortcut that might be easy.

Try something like this:

Applescript:

tell application "System Events"
   tell process "Final Cut Pro"
       --if the keyboard shortcut for export was command-shift-e for example:
       keystroke "e" using {command down, shift down}
   end tell
end tell

Then add delays to make sure the script doesn't get ahead of the program and add additional key commands. This will only work obviously if you are able to manually perform the whole process with the keyboard.


Filed under: System

Offline

 

#3 2009-02-20 12:29:21 am

hhas
Member
Registered: 2004-04-29
Posts: 461

Re: How to AppleScript FInal Cut Pro using Apple Events?

jaspersiegers wrote:

Hi,

I know it's not possible to applescript Final Cut Pro.
However it is possible to talk to Final Cut Pro, or FCP, through Apple Events.
http://developer.apple.com/samplecode/F … index.html
However that is all obj-c and I'm not very good in that wink

Since Apple Events are used by AppleScript with most scriptable applications I was wondering if there was a way to applescript FCP.
All I need is to automate is for FCP to export an XML of an fcp project file.

Is this possible?


You can send events to FCP from AppleScript using its raw chevron-based syntax. You can't get results back as FCP stupidly packs return values into reply events under a non-standard parameter key. This may not be a problem if you're only doing exports; if it is, you'll need to use C/ObjC or a patched copy of appscript. ISTR someone once working on a Python module for controlling FCP via appscript; I don't know if it ever got released though.


Learn AppleScript, 3rd edition - Sanderson & Rosenthal (Apress)

Offline

 

#4 2009-02-20 07:22:50 am

jaspersiegers
Member
From:: The Netherlands
Registered: 2006-08-30
Posts: 48

Re: How to AppleScript FInal Cut Pro using Apple Events?

Thanks guys.

I figured something out.
To open a project file you could simply doet.

Applescript:


   tell application "Final Cut Pro"
       Â«event KeyGofcP» given «class fcpP»:POSIX file aFile
   end tell

this works but it doesn't work to export a file using

Applescript:


   tell application "Final Cut Pro"
       Â«event KeyGeXML» given «class fcpP»:POSIX file aFile
   end tell

Anyone an idea to get the result stream back?


Filed under: Final

Offline

 

#5 2009-02-21 06:39:05 am

hhas
Member
Registered: 2004-04-29
Posts: 461

Re: How to AppleScript FInal Cut Pro using Apple Events?

jaspersiegers wrote:

this works but it doesn't work to export a file using

Applescript:


   tell application "Final Cut Pro"
       Â«event KeyGeXML» given «class fcpP»:POSIX file aFile
   end tell

Anyone an idea to get the result stream back?


Again, AppleScript can't see values returned by FCP because FCP is a big lump of stupid. You will have to use the system C/ObjC APIs (packaged as an osax or wrapped in an ObjC class an invoked via Studio's 'call method' if you want to use it from AppleScript), or appscript (which can be modified to extract the relevant data from the reply events).


Learn AppleScript, 3rd edition - Sanderson & Rosenthal (Apress)


Filed under: Final

Offline

 

#6 2009-02-23 07:30:30 am

jaspersiegers
Member
From:: The Netherlands
Registered: 2006-08-30
Posts: 48

Re: How to AppleScript FInal Cut Pro using Apple Events?

Would you happen to know how this is done via Obj-C?
Since my Obj-C is very poorly.

I'll look into appscript.

Offline

 

#7 2009-08-05 10:22:56 am

apple
Member
Registered: 2009-08-05
Posts: 1

Re: How to AppleScript FInal Cut Pro using Apple Events?

hhas wrote:
jaspersiegers wrote:

this works but it doesn't work to export a file using

Applescript:


   tell application "Final Cut Pro"
       Â«event KeyGeXML» given «class fcpP»:POSIX file aFile
   end tell

Anyone an idea to get the result stream back?


Again, AppleScript can't see values returned by FCP because FCP is a big lump of stupid. You will have to use the system C/ObjC APIs (packaged as an osax or wrapped in an ObjC class an invoked via Studio's 'call method' if you want to use it from AppleScript), or appscript (which can be modified to extract the relevant data from the reply events).


Did you get that to work?


Filed under: Final

Offline

 

#8 2009-08-27 01:24:56 pm

jaspersiegers
Member
From:: The Netherlands
Registered: 2006-08-30
Posts: 48

Re: How to AppleScript FInal Cut Pro using Apple Events?

NO I haven't.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)