Hi Guys,
I’m in trouble again.
Long story - I have a script for photoshop that upon receiving files from a camera into a folder launches the app and makes a contact sheet from the files, then runs through some actions and then saves the resulting file.
This works perfectly almost all of the time. Unfortunately due to unknown circumtances every now and again I get a corrupt file from the camera which results in photoshop throwing up an error message which stops the whole script process unless I am there to hit “cancel” or “continue”. I need the whole process to run automatically so this isn’t good.
From posting on this site before I have learnt that opening the files in Graphic Converter and then saving them before opening them again in photoshop will solve this problem. Apparently Graphic Converter is better at opening slightly dodgy files? This does seem to be the case so my next step is to write a script that will do this opening and saving of the files in GC before carrying on with my photoshop script.
Here is my photoshop script -
on adding folder items to this_folder after receiving added_items
tell application "Finder"
if (count files in folder "receiving" of desktop) = 4 then
tell application "Finder"
activate
set theDate to (current date)
copy theDate to b
set the month of b to January
set monthNum to (1 + (theDate - b + 1314864) div 2629728)
if (monthNum < 10) then
set monthNum to "0" & (monthNum as string)
end if
set yearNum to the year of theDate
set dateNum to the day of theDate
if (dateNum < 10) then
set dateNum to "0" & dateNum
end if
set hourNum to the hours of theDate
if (hourNum < 10) then
set hourNum to "0" & hourNum
end if
set minuteNum to the minutes of theDate
if (minuteNum < 10) then
set minuteNum to "0" & minuteNum
end if
set secondNum to the seconds of theDate
if (secondNum < 10) then
set secondNum to "0" & secondNum
end if
set theFileName to (yearNum as string) & "-" & (monthNum as string) & "-" & (dateNum as string) & "-" & (hourNum as string) & "-" & (minuteNum as string) & "-" & (secondNum as string) & ".psd"
set theFolderName to (yearNum as string) & "-" & (monthNum as string) & "-" & (dateNum as string) & "-" & (hourNum as string) & "-" & (minuteNum as string) & "-" & (secondNum as string)
set newfolder to make new folder at "Macintosh HD:Users:Desktop:backup:" with properties {name:theFolderName}
end tell
tell application "Finder"
activate
set theFiles to files of folder "receiving" as alias list
end tell
tell application "Adobe Photoshop CS3"
activate
--does it's stuff and then saves the psd file to newfolder
end tell
tell application "Finder"
move (every item of folder "Macintosh HD:Users:Desktop:receiving:") to folder theFolderName of folder "backup" of desktop
end tell
end if
end tell
end adding folder items to
I was assuming that I would be able to do the same sort of “on adding” script for Graphic converter but I’m afraid I can’t work out how to open the files (they will have a different name each time so I can’t be file specific) and then save them again using the same file name. It might be best to save them to a new folder and run the photoshop script from that folder.
In my photoshop script it is making a contact sheet from the available files in the folder therefore I don’t have to tell it which files specifically to open.
I’m sure I’ve lost you all by now but any help would be most appreciated.
JM