finder add names
I’m trying to create a script that will allow me to choose from a list of 6 different names (Aproof, Bproof, Cproof etc.) and, depending on what was chosen, append the chosen name to a group of PDFs.
For example, if the PDF names are:
XX_01.pdf
XX_02.pdf
XX_03.pdf
and the chosen name from the list is Aproof then append that to
XX-01-Aproof.pdf,
XX-02-Aproof.pdf
XX_03-Aproof.pdf.
I know Automator or Adobe Bridge can easily do this, but I would like to do it in Applescript. This is what I have so far, but I need your expertise to finalize it. Thanks in advance.
tell application “Finder” to set theFiles to files of source_folder whose name extension is “pdf”
if (count of theFiles) is 0 then
display dialog “No pdfs found” buttons “Cancel” default button “Cancel” with icon 0 giving up after 6
return
end if
set the_choice to {“Aproof”, “Bproof”, “Cproof”, “Dproof”, “Eproof”, “Fproof”}
set the_choiceFav to choose from list the_choice with title “” with prompt “Select a proof name to append to the pdfs”
if the_choiceFav is false then
error number -128 (* user cancelled *)
else if item 1 of the_choiceFav is “Aproof” then
-–append or add _Aproof to the PDF
-–example original pdf name is 12345.pdf will be 12345_Aproof.pdf
else if item 1 of the_choiceFav is “Bproof” then
-–append or add _Bproof to the PDF
else if item 1 of the_choiceFav is “Cproof” then
-–append or add _Cproof to the PDF
else if item 1 of the_choiceFav is “Dproof” then
-–append or add _Dproof to the PDF
else if item 1 of the_choiceFav is “Eproof” then
-–append or add _Eproof to the PDF
else if item 1 of the_choiceFav is “Fproof” then
-–append or add _Fproof to the PDF
end if
display alert "All done! Proof names added "