Finder append

Joined
Apr 11, 2016
Messages
1
Reaction score
0
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 & the chosen name from the list is Aproof then append that to the PDFs XX-01-Aproof.pdf, XX-02-Aproof.pdf, XX_03-Aproof.pdf. I know Automator or Adobe Bridge can easily do that, but I would like to do it with Applescript. I need your expertise to finalize how to name the PDFs. Thanks in advance.

Code:
set source_folder to choose folder with prompt “Select folder with Pdfs”
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 "
 
Last edited:

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,105
Reaction score
497
Hello and welcome.

I don't have much experience with AppleScript/Automator. Maybe another member will chime in, or you can try the folks over at MacScripter.

C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top