I don’t remember where I got this script, so unfortunately, I can’t give credit where credit is due. But here’s the problem I’m having:
The script worked fine when I first got it. It seems to have stopped working all by itself just this week. The only changes to my system since I first got the script is Apples last Panther security update. Might have broken something. Very strange. Anyways, whenever I drag multiple photos onto the droplet (which is in my Finder sidebar), I get a message saying “The action could not be completed because the folder already exists,” referring to the temp folder created by the script. The error dialog has two buttons, Edit and OK. Only one image gets moved to the temp folder, and then the error pops up. The script won’t continue past this point. Like I said, it worked before, and then mysteriously started this behavior. Here’s the script:
on open (these_items)
set itemstring to these_items as string
--display dialog itemstring
tell application "Finder"
repeat with this_item in these_items
set theChar to the count of characters in itemstring
set lastChar to character theChar in itemstring
set theFolder to (make new folder at desktop with properties {name:"temp photo folder"})
move this_item to theFolder
end repeat
set theContents to the entire contents of theFolder
set theCount to the count of theContents
set theCount to (theCount * 3)
set this_path to path to desktop folder as string
set this_path to this_path & "temp photo folder"
set this_path to the POSIX path of this_path
end tell
-- convert the file reference to UNIX style
tell application "iPhoto" to activate
tell application "System Events"
tell process "iPhoto"
-- open import dialog
keystroke "I" using {command down, shift down}
-- summon path input sheet
keystroke "/" using control down
keystroke this_path
delay 5
keystroke return
delay 2
keystroke return
end tell
end tell
tell application "Finder"
delay theCount
move theFolder to trash
activate
display dialog "Done Importing." buttons {"Done", "Empty Trash", "View Trash Contents"}
if the button returned of the result is "Empty Trash" then
empty trash
else if the button returned of the result is "View Trash Contents" then
set trash_path to path to trash folder as string
set this_window to make new Finder window
set the target of this_window to the trash_path
end if
end tell
end open
Thanks in advance for any help you can give.