I have written a script to change some Photos in PhotoShop. The Script works well but if I drop a Folder of Photos I get the final Dialog box twice? Can someone tell me why this is??
Here’s my code:
on run
display dialog "To use this script, please drag files onto its Finder icon"
end run
on open myFinderList
repeat with myFinderItem in myFinderList
tell application "Finder" to set myItemIsFolder to (kind of myFinderItem = "folder")
if myItemIsFolder then
tell application "Finder" to set myFolderContents to (every item of myFinderItem)
open myFolderContents
else
set theDay to the day of (current date)
set theMonth to the month of (current date)
set theDate to theDay & " " & theMonth
set ConvertedFolder to (path to desktop folder) & "Converted " & theDate & ":" as string
try
get ConvertedFolder as alias
on error
tell application "Finder"
set targetFolder to make new folder at (path to desktop folder) with properties {name:"Converted " & theDate}
end tell
end try
with timeout of 864000 seconds
tell application "Adobe Photoshop CS"
set ConvertThis to open (myFinderItem as alias)
set myDocumentName to "edit " & name of current document
set myDocumentPath to ConvertedFolder & myDocumentName as string
do action "Change Size" from "AppleScripts"
save current document in myDocumentPath as JPEG with options {class:JPEG save options, quality:12}
close current document
end tell
end timeout
end if
end repeat
display dialog "All your Photos have been converted." buttons {"OK"} default button 1 with icon stop giving up after 10
end open
Thanks