ok. i’m almost there…
i’ve finished the script. it runs silently and very smooth. and, best of all, very fast.
it waits when it needs to, it renames the files if they are already in use, it keeps a log of errors, and does the resizing beautifully, but…
i’m on MacOSx 10.4.7, with the latest versions of Imagemagick and Ghostscript (acording to fink).
when i was messing around in the Terminal, trying to understand how to tell Imagemagick to resize and everything, it could process any kind of file i wanted. but when applescript does de “do shell script” it cannot process EPS (nor illustrator, nor photoshop)…
i typed the exact string in the script in the Terminal, and the Terminal processes the images without a problem.
-this is the error message:
sh: line 1: gs: command not found
sh: line 1: gs: command not found
convert: no decode delegate for this image format `/files/EPSi.eps’.
-this is the processing part of the code:
on process_files(source_file, file_name, pwg_folder, tn_folder)
try
set the pwg_path to ((pwg_folder as string) & file_name) as string
set the tn_path to ((tn_folder as string) & "tn_" & file_name) as string
set original to POSIX path of source_file
set pwg to POSIX path of pwg_path
set tn to POSIX path of tn_path
with timeout of 180 seconds
do shell script "/sw/bin/convert " & original & " -resize 400x400 -colorspace RGB " & pwg & " && /sw/bin/convert " & pwg & " -resize 120x120 " & tn
end timeout
on error the error_message number the error_number
set the error_text to "Error: " & the error_number & ". " & the error_message
my write_error_log(the error_text)
end try
return 0
end process_files
i belive that for some odd reason, applescript isn’t using the ‘codec’ from Ghostscript (thats the GS?), so it cannot read nor write EPSs… but why?
and, more important, how do i make applescript to read and write EPSs???
this one really left me stupid…
thanks to everyone, you’ve been too much helpfull.