You can save this code as droplet and drop there swf and fla files. Configure the destination directory in the first line. Fla files will be saved as MX (flash 6) and swf files will be simply copied.
Most probably, you must adaptate the code, since it is tricky, dirty, ugly and so on, but the only way so far I’ve found to automate the process of saving thousands of flash 7 docs to flash 6. It requires OS 10.3, UI Scripting and Default Folder X. The DF requirement could be workarounded using also System Events, but… Or perhaps you don’t even need the line of code, since the working directory is suppossed to be changed with the “defaults write” thing, but… Well, adaptate it if you need. It is not very fast, but at least I can drink coffee while the machine does its job.
- No, JSFL scripting does not support save-as with parameters.
** Most probably Flash 8 will be the first scriptable version [hopes].
property targetDir : alias "path:to:backup:dir:"
on open l
repeat with i in l
set thingName to pathName(i)
set parentName to pathName(pathParent(i))
try
set destDir to alias ((targetDir as text) & parentName)
on error
do shell script "mkdir -p " & quoted form of POSIX path of ((targetDir as text) & parentName)
tell application "Finder" to update targetDir
set destDir to alias ((targetDir as text) & parentName)
tell application "Finder" to set destURL to URL of destDir
--> change save directory in Flash
do shell script "defaults delete com.macromedia.flash.7 'AppleNavServices:PutFile:0:Path';" & ¬
"defaults write com.macromedia.flash.7 'AppleNavServices:PutFile:0:Path' " & quoted form of destURL & ";" & ¬
"defaults delete com.macromedia.flash.7 'AppleNavServices:PutFile:0:HomeDirectoryPath';" & ¬
"defaults write com.macromedia.flash.7 'AppleNavServices:PutFile:0:HomeDirectoryPath' " & quoted form of destURL
end try
if (i as text) ends with ".fla" then
--> open thing
tell application "Finder" to open i
-- delay 1
--> perform save-as
tell application "System Events"
tell process "Flash"
set frontmost to true
repeat while not (exists window thingName)
delay 0.2
end repeat
keystroke "S" using {shift down, command down}
repeat 8 times
keystroke tab using {shift down, option down}
end repeat
keystroke space
repeat 3 times
keystroke (ASCII character 31)
end repeat
keystroke space
repeat while (not (exists sheet 1 of window thingName))
delay 0.2
end repeat
tell application "Default Folder X BG" to SwitchToFolder destDir --> just in case
delay 0.2
key code 76 --keystroke (ASCII character 13)
repeat
if not (exists sheet 1 of window thingName) then exit repeat
delay 0.2
end repeat
keystroke "w" using command down -- my execClose() -- keystroke "W" using command down
end tell
end tell
else if (i as text) ends with ".swf" then
do shell script "cp " & quoted form of POSIX path of i & space & quoted form of POSIX path of destDir
end if
end repeat
end open
to pathParent(f)
set f to f as Unicode text
if f does not contain ":" then set f to POSIX file f as Unicode text
set prevTids to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
if f ends with ":" then
set fParent to "" & text items 1 thru -3 of f & ":"
else
set fParent to "" & text items 1 thru -2 of f & ":"
end if
set AppleScript's text item delimiters to prevTids
alias fParent
end pathParent
to pathName(f)
set f to f as Unicode text
if f does not contain ":" then set f to POSIX file f as Unicode text
set prevTids to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
if f ends with ":" then
set fName to item -2 of f's text items
else
set fName to item -1 of f's text items
end if
set AppleScript's text item delimiters to prevTids
fName
end pathName
to execClose()
try
"/tmp/execClose.jsfl" as POSIX file as text as alias
tell application "Finder" to open result using application file id "com.macromedia.flash.7"
on error
set f to (open for access ("/tmp/execClose.jsfl" as POSIX file) with write permission)
write "d=fl.getDocumentDOM();
if (! d) {
alert('Please, open a document before running this command!');
} else {
doIt();
}
function doIt(){
fl.getDocumentDOM().close(false);
}" to f
close access f
execClose()
end try
end execClose