Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript help please: Final Cut Pro / selecting drop down items

Hi,


I am wondering if anyone can help guide me wih a spot of AppleScript?


I'm new to it as of tonight (last time I made a script was 11 years ago, and that was a very basic one!).


Basically, my problem is I have a long term bug in Final Cut Pro which causes it to crash on launch everytime, unless I delete the Preferences file first.


(btw This problem exsisted in Snow Leopard and has continued with Lion. I think it is plug-in related, but I've never figured out which or why, and have had a topic ongoing on here int he FCP forum for some time with no luck).


Anyway, so far I have made a script which trashed the preferences and launches the program, like this:



try

do shell script "rm /Users/redhavoc/Library/Preferences/Final\\ Cut\\ Pro\\ User\\ Data/Final\\ Cut\\ Pro\\ 7.0\\ Prefs.fcset "

end try

delay 1

tell application "Final Cut Pro" to activate



So far, so good.


However, what I would REALLY like to do, is continue this script to reset all the preferences automatically!


When launching FCP (as the preferences are gone) this is the first thing that comes up:


User uploaded file


So, my question is:

How can I choose which items I want selected from the drop down boxes with my AppleScript?


(Specifically, option 7 in the "Format" drop down, and option 3 in the "Rate" drop down, then more complexly, choosing which folder I want in the "Primary Scratch Disk" drop down (which opens an "Open" dialogue) ).



Thanks in advance!

MacBook Pro (2011 Quad 2.3 i7), Mac OS X (10.7.2), 8Gb Ram, 250GB SSD

Posted on Oct 15, 2011 5:55 PM

Reply
5 replies

Oct 15, 2011 6:13 PM in response to NezihSavaskan

So I have tried adding a few lines to create this:



try

do shell script "rm /Users/redhavoc/Library/Preferences/Final\\ Cut\\ Pro\\ User\\ Data/Final\\ Cut\\ Pro\\ 7.0\\ Prefs.fcset "

end try

delay 1

tell application "Final Cut Pro" to activate

tell application "System Events"

tell process "Final Cut Pro"

set the value of combo box "format" to AppleProRes422

end tel

end tell



Is that the correct way of doing it? An error seems to be returned saying:


"The variable AppleProRes422 is not defined."


I have tried putting that in quotes, I have tried replacing it with a number of the item... no luck... am I doing this the wrong way?

Oct 15, 2011 6:24 PM in response to NezihSavaskan

I've also just tried this:


try

do shell script "rm /Users/redhavoc/Library/Preferences/Final\\ Cut\\ Pro\\ User\\ Data/Final\\ Cut\\ Pro\\ 7.0\\ Prefs.fcset "

end try

delay 1

tell application "Final Cut Pro" to activate

tell application "System Events"

tell process "Final Cut Pro"

tell combo box "format" of window "Choose Setup"


clickbutton 1

repeat 6 times


keystroke (ASCII character 31)

end repeat


keystrokereturn

end tell

end tell

end tell



But this error is returned:


"System Events got an error: Can’t get window "Choose Setup" of process "Final Cut Pro"."


So either I am still doing it wrong, or I have just got the name of the combo box wrong? I tried 1 instead of "Format", no luck.

How can I work out the name of the drop down box?


Hopefully someone can help! Thanks!

Oct 15, 2011 7:42 PM in response to NezihSavaskan

Ok, so I've worked out what the drop down boxes are called by digging through the package plist and strings files.


So now I have:




try

do shell script "rm /Users/redhavoc/Library/Preferences/Final\\ Cut\\ Pro\\ User\\ Data/Final\\ Cut\\ Pro\\ 7.0\\ Prefs.fcset "

end try

delay 1

tell application "Final Cut Pro" to activate

tell application "System Events"

tell process "Final Cut Pro"


activate

tell combo box "formats" of window "firstStart"



clickbutton 1

repeat 6 times


keystroke (ASCII character 31)

end repeat


keystrokereturn

end tell

end tell

end tell




But the error now returned is:



System Events got an error: Can’t get window "firstStart" of process "Final Cut Pro".



So I changed that line to:




tell combo box "formats" of front window




But now the error says:



System Events got an error: Can’t get window 1 of process "Final Cut Pro". Invalid index.





Hmmmm.... am I getting any closer??

AppleScript help please: Final Cut Pro / selecting drop down items

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.