I just realized, there's actually a MUCH better way of getting the source file into ffmpegX. We don't need to be messing around with the text field at all. All we have to do is tell the FINDER to open our source movie
with ffmpegX. That'll make things a lot easier. So replace all that "set the string value of text field 5" business with this new method, which I'll detail in a bit.
Where do i type in the stuff in the square brackets?
Those particular lines need to be after the "get window 1". So all in all it would look something like this:
Code:
tell application "ffmpegX"
get window 1
return the title of every button of the result
end tell
1) Make the file to be converted be the file that i drop onto the script icon.
To make a droplet, there are two things you need to do:
1) Create an "on open {the_file}" statement, where the_file is the variable that will store the file that was dropped.
2) Save the script as an application.
Once we have the_file, we just open it with ffmpegX, like I mentioned before.
Code:
tell application "Finder"
open (the_file) using application file ((the application file of application process "ffmpegX") as text)
end tell
I know that whole [
application file ((the application file of application process "ffmpegX") as text)] looks nasty, and it is. I'm not sure WHY we have to coerce it to text and then back to 'application file', but...we do. Whatever works, right?
Another thing I should mention is that the "open" handler will only process ONE file. If you drag a bunch of files onto your icon, it won't process them all. There are some nasty ways around this, though. Take a look at some of Apple's examples, like "/Library/Scripts/ColorSync/Build profile info web page".
2) Tell ffmpegX the settings for the target format. (I know you told me create a Preset format but i had trouble loading it)
I'm getting problems myself now, too. Ouch. I have NO problems when opening my presets manually. I'm not sure what the script is doing differently, but I think that's what we need to figure out.
You COULD enter all your settings by manipulating the buttons and stuff, the same way we dismissed the registration window and entered the file paths. Follow the general procedure I explained before, and you should be able to manually configure it. Buuuut, it'd be a big fat pain in the rear, to say the least. It takes a lot of trial-and-error poking around to get that kind of thing done, and ffmpegX has a LOT of interface elements to contend with. I'm scared just thinking about it.
I'm going to mess around with this later. There's gotta be a way to get it working. The code I have so far (which doesn't work sometimes) is this:
Code:
tell application "Finder"
open file "Path:to:preset.ffx"
open (the_file) using application file ((the application file of application process "ffmpegX") as text)
end tell
Edit: I just flipped those two lines, so that it'll load the preset AFTER it loads the movie, and now it seems to work. Does that work on your end, too?
3) I need to do something about what the file will be saved as. I want the file to be saved to the desktop, but I don't want the file to be saved as XYZ.mov. I want each file to be saved as something else.
That's doable, too. It just depends on how you want to do it.
Do you want to use a standard Save dialog? If so, what you need is in Standard Additions, an AppleScript user's best friend. It's located at "/System/Library/ScriptingAdditions/StandardAdditions.osax". Drag it onto Script Editor and peek inside. In the "User interaction" section, you'll find everything you need. To get a standard Save dialog, use the "choose file name" function.
Also, using the new method I mentioned of loading the movie into ffmpegX, we'll get ffmpegX's automatic destination generation, which will be in the same folder as the source. If that's good enough for you, it'd save a lot of effort. Otherwise, use
choose file name, and convert the result to a unix-style path using System Events, like we did before.