Applescript droplet to generate png previews using LDView
2011-12-01, 10:01 (This post was last modified: 2011-12-01, 10:01 by Ramón Figueroa-Centeno.)
2011-12-01, 10:01 (This post was last modified: 2011-12-01, 10:01 by Ramón Figueroa-Centeno.)
Aloha,
The following saved as an application from the AppleScript Editor generates png previews:
It assumes that LDview is in the application folder. Modify the "ldview" property otherwise.
Ramón
The following saved as an application from the AppleScript Editor generates png previews:
Code:
property ldview : "/Applications/LDView/LDView.app/Contents/MacOS/LDView"
on run
set root to choose folder with prompt "Please select folder."
generatepreview(root)
end run
on open root
if folder of (info for root without size) is true then
generatepreview(root)
end if
end open
on generatepreview(root)
set suffix to "\\( -iname \"*.ldr\" -o -iname \"*.mpd\" -o -iname \"*.dat\" \\)"
set root to (POSIX path of root) as string
set root to quoted form of ((characters 1 through -2 of root) as string)
set ldrs to do shell script "find " & root & " -type f " & suffix
repeat with ldr in paragraphs of ldrs
try
set dirname to do shell script "dirname " & quoted form of ldr
set png to ((characters 1 through -5 of ldr) as string) & ".png"
do shell script "cd " & dirname & "; " & ldview & " " & quoted form of ldr & " -SaveSnapshot " & quoted form of png
end try
end repeat
end generatepreview
It assumes that LDview is in the application folder. Modify the "ldview" property otherwise.
Ramón