Hi guys,
I’m having trouble with the “on adding folder items to” command
With the script below if I comment out the “on adding” and “end adding” lines it works perfectly but if I keep the lines in and attach the script to a folder it gets as far as making a contact sheet in photoshop but then stops.
Any ideas why? I would be slightly less confused if it just didn’t work but why it works just to a certain point I don’t understand.
Thanks,
JM
--on adding folder items to this_folder
tell application "Finder"
if (count files in folder "photo" 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:jean:Desktop:backup:" with properties {name:theFolderName}
end tell
tell application "Finder"
activate
move (every item of folder "Macintosh HD:Users:jean:Desktop:photo:") to folder theFolderName of folder "backup" of desktop
set theFiles to files of folder (theFolderName as text) of folder "backup" as alias list
end tell
tell application "Adobe Photoshop"
activate
creat contact sheet from files thefiles with options {resolution:346, width:1281, height:1904, column count:2, row count:2, autospacing:false, caption:false, horizontal offset:23, vertical offset:36}
resize image current document width 9.4.4 height 13.9777
do action "photo" from "Default Actions.atn"
purge all caches
set myFile to (newfolder as text) & (theFileName)
set myOptions to {class:photoshop save options, embed color profile:true, save spot colors:true, save alpha channels:true, save annotations:true, save layers:true}
save current document in file myfile as Photoshop format with options myoptions appending no extension without copying
close current document saving no
end tell
end if
end tell
--end adding folder items to