on adding folder items to this_folder after receiving PhotoshopFiles
try
set ptd to path to desktop as text
--set ptdpp to ptd & "Photoshop Processing" as text
set ptdpp to this_folder as text
set ptdpif to ptd & "Processed Images Folder" as text
set ptdpsf to ptd & "Processed Stored Folder" as text
set fileToLog to (ptdpif) & ":Photoshop_Batch_Errors_Log.txt" as text
tell application "Finder"
if not (exists folder ptdpif) then
make new folder at folder ptd with properties {name:"Processed Images Folder"}
end if
if not (exists folder ptdpsf) then
make new folder at folder ptd with properties {name:"Processed Stored Folder"}
end if
if not (exists file fileToLog) then
make new file at folder ptdpif with properties {name:"Photoshop_Batch_Errors_Log.txt"}
end if
set PhotoshopFiles to files of folder ptdpp as alias list
end tell
say (count of PhotoshopFiles)
delay 4
tell application "Adobe Photoshop CS6"
activate
repeat with this_File in PhotoshopFiles
tell application "Finder"
set file_Name to name of this_File
set file_Extension to name extension of this_File
set file_Name2 to characters 1 through -((count of file_Extension) + 1) of file_Name
if file_Extension = "jpg" then set file_Extension to "jpeg"
set file_to_save to (ptdpif & ":" & file_Name as text) --POSIX path of
--display dialog file_to_save
end tell
open this_File
set display dialogs to never
try
do action "Wood Frame - 50 pixel" from "Default Actions"
save document {name:file_Name} in file file_to_save as file_Extension with copying -- gives 'File/Folder expected'
on error errmsg
display dialog errmsg
end try
try
close document 1 saving no
end try
end repeat
end tell
tell application "Finder"
move PhotoshopFiles to folder ptdpsf
end tell
on error errmsg
display dialog errmsg
end try
end adding folder items to