Hi,
We wrote this “Automatic Proxy Image Generator” script.
What the script does is:
When i attach this folder action to a folder named “FullRes_DPX”, it becomes a watch folder, it watches for incoming hires DPX image sequences, then it tells the application shake to resize the files to 720x576 sized images into a folder named “Proxy_DPX”
But there are some problems that i could not resolve:
1-At first we tried to make the resize part of the script with NConvert (command-line utility of XNView), it somehow was not stable. Sometimes it worked, other times it didn’t. I changed the resize application to Shake and it was more stable.
This led me to think that there is a problem in the looping part of the script.
2-When we drag a folder which has images in it, the script creates the new folder in the “Proxy_DPX” folder but it doesn’t resize and copy the images in the dragged folder.
Could you please have a look at the script and point me to the problem areas.
Thank you,
The script is as follows:
on adding folder items to this_folder after receiving these_items
set AppleScript's text item delimiter's to ":"
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
tell application "Finder"
set sourcepath1 to container of this_item
set item_name1 to displayed name of this_item
end tell
set sourcepath to sourcepath1 as text
set item_name to item_name1 as text
set sourcepath_Unix to the quoted form of the POSIX path of this_item
set findThis to "FullRes_DPX"
set replaceWith to "Proxy_DPX"
set destinationPath to switchText of sourcepath from findThis to replaceWith
set destinationPath_Unix to the quoted form of the POSIX path of destinationPath
set dest to (destinationPath_Unix & item_name1)
if folder of (info for this_item) is true then
tell application "Finder"
make new folder at destinationPath with properties {name:item:name}
end tell
tell application "System Events"
attach action to this_item
using ":Users:makina:Library:Scripts:Folder Action Scripts:Proxy_PAl.scpt"
end tell
else
do shell script ("/Applications/Shake/shake.app/Contents/MacOS/shake " & sourcepath_Unix & " -resize 720 576 -fo " & dest)
end if
end repeat
end adding folder items to
to switchText of theText from SearchString to ReplaceString
set OldDelims to AppleScript's AppleScripts's text item delimiters
set AppleScript's AppleScript's text item delimiters to SearchString
set newText to text items of theText
set AppleScript's AppleScript's text item delimiters to ReplaceString
set newText to newText as text
set AppleScript's AppleScript's text item delimiters to OldDelims
return newText
end switchText