Rename the current active file?
I'm wanting a script to be able to rename open Photoshop files, if possible.
I cobbled this together from an existing script:
tell application "Adobe Photoshop CS5"
activate
set old_name to name of current document
set dialog_result to display dialog ¬
"Rename active document:" default answer (old_name) ¬
buttons {"Cancel", "Rename"} default button 2 ¬
with icon note
if button returned of dialog_result = "Rename" then
set new_name to text returned of dialog_result
set d to properties of current document
if path of d is equal to missing value then
set name of current document to new_name
else
tell me to set the_file to POSIX file (d's path as text) as alias
tell application "Finder"
set name of the_file to new_name
end tell
end if
end if
end tell
If I run it it shows the dialogue window, but when I enter the new name and hit Return it throws out lots of errors.
Is something like this possible?
