This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
software:mov2flv [2010/10/10 04:40] – created admin | software:mov2flv [2010/10/12 01:00] (current) – admin | ||
---|---|---|---|
Line 17: | Line 17: | ||
-- It uses Adobe After Effects CS3 to convert, correct audio offset and render into flv with on6/mp3 codec | -- It uses Adobe After Effects CS3 to convert, correct audio offset and render into flv with on6/mp3 codec | ||
-- | -- | ||
+ | -- THIS SCRIPT NEEDS SPECIAL PERMISSION FROM AFTER EFFECTS, OTHERWISE FILECOPY WILL NOT WORK. ENABLE: | ||
+ | -- Preferences > General, and select “Allow Scripts To Write Files And Access Network.” | ||
-- Applet Code | -- Applet Code | ||
Line 22: | Line 24: | ||
-- The following appears only when the droplet is double clicked | -- The following appears only when the droplet is double clicked | ||
on run | on run | ||
- | | + | display dialog " |
end run | end run | ||
-- This droplet processes both files or folders of files dropped onto the applet | -- This droplet processes both files or folders of files dropped onto the applet | ||
on open (these_items) | on open (these_items) | ||
- | | + | repeat with i from 1 to the count of these_items |
- | set this_item to (item i of these_items) | + | set this_item to (item i of these_items) |
- | set the item_info to info for this_item | + | set the item_info to info for this_item |
- | if folder of the item_info is true then | + | if folder of the item_info is true then |
- | process_folder(this_item) | + | process_folder(this_item) |
- | else if (alias of the item_info is false) and (the name extension of the item_info is " | + | else if (alias of the item_info is false) and (the name extension of the item_info is " |
- | process_item(this_item) | + | process_item(this_item) |
- | end if | + | end if |
- | end repeat | + | end repeat |
- | + | ||
- | -- display dialog " | + | -- display dialog " |
end open | end open | ||
-- this sub-routine processes folders | -- this sub-routine processes folders | ||
on process_folder(this_folder) | on process_folder(this_folder) | ||
- | | + | set these_items to list folder this_folder without invisibles |
- | repeat with i from 1 to the count of these_items | + | repeat with i from 1 to the count of these_items |
- | set this_item to alias ((this_folder as text) & (item i of these_items)) | + | set this_item to alias ((this_folder as text) & (item i of these_items)) |
- | set the item_info to info for this_item | + | set the item_info to info for this_item |
- | if folder of the item_info is true then | + | if folder of the item_info is true then |
- | process_folder(this_item) | + | process_folder(this_item) |
- | else if (alias of the item_info is false) and (the name extension of the item_info is " | + | else if (alias of the item_info is false) and (the name extension of the item_info is " |
- | process_item(this_item) | + | process_item(this_item) |
- | end if | + | end if |
- | end repeat | + | end repeat |
end process_folder | end process_folder | ||
-- this sub-routine processes files | -- this sub-routine processes files | ||
on process_item(this_item) | on process_item(this_item) | ||
- | | + | -- NOTE that the variable this_item is a file reference in alias format |
- | set full_path to the POSIX path of this_item | + | set full_path to the POSIX path of this_item |
- | -- !!! MODIFY THESE PARAMETERS TO SUIT if you have other preferences you'd like to use | + | -- !!! MODIFY THESE PARAMETERS TO SUIT if you have other preferences you'd like to use |
- | -- activate AE (this will be ignored if it's already open) | + | -- activate AE (this will be ignored if it's already open) |
- | try | + | try |
- | tell application "Adobe After Effects CS3" | + | tell application "Adobe After Effects CS3" |
- | with timeout of 300 seconds | + | with timeout of 3600 seconds |
- | activate | + | activate |
- | + | ||
- | -- begin After Effects script: close any open project (if it isn't rendering) | + | -- begin After Effects script: close any open project (if it isn't rendering) |
- | set line1 to "if (app.project.renderQueue.rendering != true){" | + | set line1 to "if (app.project.renderQueue.rendering != true){" |
- | set line2 to " | + | set line2 to " |
- | set closeAnyExistingProjects to line1 & line2 | + | set closeAnyExistingProjects to line1 & line2 |
- | DoScript closeAnyExistingProjects with override | + | DoScript closeAnyExistingProjects with override |
- | -- end After Effects script | + | -- end After Effects script |
- | + | ||
- | -- begin After Effects script | + | -- begin After Effects script |
- | set line1 to " | + | set line1 to " |
- | set line2 to "var myProject = app.newProject(); | + | set line2 to "var myProject = app.newProject(); |
- | set line3 to " | + | set line3 to " |
- | set line4 to "var myProject = app.project; | + | set line4 to "var myProject = app.project; |
- | set line5 to "var theFile = \"" | + | set line5 to "var theFile = \"" |
- | set line6 to "var outFile = theFile.substring(0, | + | set line6 to "var outFile = theFile.substring(0, |
- | set line7 to "var c=0;" & return | + | set line7 to "time = new Date();" |
- | set line8 to "var cs=\" | + | set line8 to "var tmpFile = \" |
- | set line9 to " | + | set line9 to "var c=0;" & return |
- | set line10 | + | set line10 |
- | set line11 | + | set line11 |
- | set line12 | + | set line12 |
- | set line13 | + | set line13 |
- | set line14 | + | set line14 |
- | set line15 | + | set line15 |
- | set line16 | + | set line16 |
- | set line17 | + | set line17 |
- | set line18 | + | set line18 |
- | set line19 | + | set line19 |
- | set line20 | + | set line20 |
- | set line21 | + | set line21 |
- | set line22 | + | set line22 |
- | set line23 | + | set line23 |
- | set line24 | + | set line24 |
- | set line25 | + | set line25 |
- | set line26 | + | set line26 |
- | set line27 | + | set line27 |
- | set line28 | + | set line28 |
- | set line29 | + | set line29 |
- | set line30 | + | set line30 |
- | set line31 | + | set line31 |
- | set line32 | + | set line32 |
- | set line33 | + | set line33 to "var tempFile = File(tmpFile);" |
- | set mov2flv to line1 & line2 & line3 & line4 & line5 & line6 & line7 & line8 & line9 & line10 & line11 & line12 & line13 & line14 & line15 & line16 & line17 & line18 & line19 & line20 & line21 & line22 & line23 & line24 & line25 & line26 & line27 & line28 & line29 & line30 & line31 & line32 & line33 | + | set line34 to " |
- | DoScript mov2flv | + | set line35 to " |
- | -- end After Effects script | + | |
- | + | set line36 | |
- | end timeout | + | set line37 |
- | + | set line38 | |
- | -- begin After Effects script: quit application | + | set mov2flv to line1 & line2 & line3 & line4 & line5 & line6 & line7 & line8 & line9 & line10 & line11 & line12 & line13 & line14 & line15 & line16 & line17 & line18 & line19 & line20 & line21 & line22 & line23 & line24 & line25 & line26 & line27 & line28 & line29 & line30 & line31 & line32 & line33 |
- | set line1 to " | + | DoScript mov2flv |
- | set line2 to " | + | -- end After Effects script |
- | DoScript line1 & line2 with override | + | |
- | -- end After Effects script | + | end timeout |
- | + | ||
- | delay 5 | + | -- begin After Effects script: quit application |
- | + | set line1 to " | |
- | end tell | + | set line2 to " |
- | on error the error_message number the error_number | + | DoScript line1 & line2 with override |
- | display dialog " | + | -- end After Effects script |
- | end try | + | |
+ | delay 5 | ||
+ | |||
+ | end tell | ||
+ | on error the error_message number the error_number | ||
+ | display dialog " | ||
+ | end try | ||
end process_item | end process_item | ||
on getFileName(thefile) | on getFileName(thefile) | ||
- | | + | set {oldDelims, AppleScript' |
- | set mytextfilename to last text item of (thefile as text) | + | set mytextfilename to last text item of (thefile as text) |
- | set AppleScript' | + | set AppleScript' |
- | return mytextfilename | + | return mytextfilename |
end getFileName | end getFileName | ||
</ | </ |