Exorcise converted RAWs (AppleScript) |
Saturday, February 26, 2005 |
property crindent : (ASCII character 13) & " • " local rawNames, rawName, jpegName, jpegs, convertedRaws, namesToDelete, oldDelimiters set namesToDelete to {} tell application "iView MediaPro" tell catalog 1 set jpegs to name of every media item whose ¬ name begins with "CRW_" and name ends with ".jpg" set rawNames to (name of every media item whose ¬ (name ends with ".CRW" or name ends with ".crw") and ¬ media info's encoding = "Canon RAW" and ¬ label index = 0) repeat with rawName in rawNames set jpegName to ((characters 1 through ((number of characters of rawName) - 4) of rawName) ¬ as string) & ".jpg" if jpegs contains jpegName then set namesToDelete to namesToDelete & rawName end if end repeat set convertedRaws to (media items where name is in namesToDelete) if length of convertedRaws is 0 then display dialog "No converted RAW images available" buttons {"Cancel"} default button 1 end if if length of convertedRaws ≠ length of namesToDelete then set AppleScript's text item delimiters to crindent set namesToDelete to crindent & namesToDelete as string set AppleScript's text item delimiters to oldDelimiters display dialog "Too many items with same name in:" & namesToDelete buttons {"Cancel"} default button 1 end if end tell set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to crindent set namesToDelete to crindent & namesToDelete as string set AppleScript's text item delimiters to oldDelimiters display dialog "Move files to trash? " & namesToDelete buttons {"Cancel", "Move to Trash"} default button 2 delete convertedRaws with removing original end tell |
|
Top | Made with Script Debugger 3.0 |