Duplicate selected item and rename in a script.
I made this little applescript to use in Finder, however I would like it to work within Adobe Bridge, but I have discovered it does use applescript.
To explain what the script.
Get selected Item
Duplicate
Prompt for new file name
Rename original image to "result of input text"
Prompt for new file name (silver)
Rename original image to "result of input text" & "_Silver"
If required Prompt for new file name (Rose Gold)
Duplicate file and Rename original image to "result of input text" & "_Rose"
I hope that makes sense and I hope someone can help me translate this to Javascript for Bridge.
Many Thanks
Matt
tell application "Finder"
set thisFile to (item 1 of (get selection) as alias)
set Resultsuffix to (display dialog "ENTER SUFFIX" & return & "For Example:-" & tab & "_2_x2" & return & "Leave blank for nothing" default answer "")
set suffix to the text returned of Resultsuffix
if button returned of Resultsuffix is "Cancel" then
tell me to quit
end if
set ResultGoldCode to (display dialog "Scan GOLD Item" default answer "")
set GoldCode to the text returned of ResultGoldCode
if button returned of ResultGoldCode is "Cancel" then
tell me to quit
end if
set RGFile to (duplicate thisFile)
--set selection to RGFile
set SilverCode to the text returned of (display dialog "Scan Silver Item" default answer "")
--set newFile to (item 1 of (get selection) as alias)
set newFile to RGFile as alias
log newFile
set RoseResult to (display dialog "Scan Rose Gold Item" default answer "" buttons {"Not Required", "Done"} default button "Done")
if button returned of RoseResult is "Done" then
set RoseCode to text returned of RoseResult
--set selection to (duplicate RGFile)
set TTnewFile to (duplicate RGFile)
--set newFile to (item 1 of (get selection) as alias)
set newFile to TTnewFile as alias
else
--do nothing
end if
end tell
tell application "System Events"
tell application "Finder"
set oname to name of thisFile
set AppleScript's text item delimiters to "."
if number of text items of oname > 1 then
set oname to text items 1 thru -2 of oname as text
end if
end tell
if name extension of newFile is "" then
set name of newFile to SilverCode & suffix & "_silver"
else
set name of newFile to (SilverCode & suffix & "_Silver" & "." & name extension of newFile)
end if
if button returned of RoseResult is "Done" then
if name extension of thisFile is "" then
set name of thisFile to GoldCode & suffix & "_Gold"
else
set name of thisFile to (GoldCode & suffix & "_Gold" & "." & name extension of thisFile)
end if
else
if name extension of thisFile is "" then
set name of thisFile to GoldCode & suffix
else
set name of thisFile to (GoldCode & suffix & "." & name extension of thisFile)
end if
end if
if button returned of RoseResult is "Done" then
if name extension of thisFile is "" then
set name of RGFile to RoseCode & suffix & "_rose"
else
set name of RGFile to (RoseCode & suffix & "_rose" & "." & name extension of thisFile)
end if
end if
--tell application "Renamer GoldSilver" to if it is running then quit
tell me to quit
end tell
