I have been making a script with the help of the forums on this fantastic site, and have come a little bit stuck.
The idea of this script ideally is, I will save the script as a application and place it into a folder, what I need the script to be able to do, is to recognise where it is, and when the application is run, to ask for a filename, then create a folder called Originals and save the final pdf as the filename. As the script inserts each individual pdf into the multi page pdf and then closes that pdf, i then want that pdf to be moved into the folder Originals.
Where I am stuck is how to make the script realise where it is, as I have only got this to work by specifying the exact location. Secondly I am totally stuck getting the script to move the pdf file which has just been closed to move into the folder called Originals. Any help on this will be a lifesaver. The script is shown below, it does work in its current state, it is just the polishing off that I am having issues with.
If anyone recognises some of the script below, that is because as I said, this script was made using script from this site.
set target_folder to (("Sampler:finished_file:") as string)
set target_name_entry to display dialog "Please enter the name of the merged pdf:" default answer "unspecified " with icon note buttons {"Cancel", "Continue..."} default button "Continue..." giving up after 30 --Asks imager to Input the name of the scan folder, and calls it "file_name_entry"
set target_name to text returned of target_name_entry --Designates the text that was entered to be the file name.
--set target_name to "combined.pdf"
set target_pdf to target_folder & target_name
set source_folder to ("Sampler:Users:powerbook:Desktop:Merge:") as alias
set theDate to current date
set theDay to the day of theDate
set theMonth to the month of theDate
tell application "Finder"
make new folder at source_folder with properties {name:"" & target_name & "-" & theMonth & " " & theDay}
end tell
try
tell application "Finder"
set component_PDFs to every file of source_folder whose name ends with ".pdf"
try
delete file target_pdf
end try
set the_name to name of (item 1 of component_PDFs as alias)
duplicate (item 1 of component_PDFs as alias) to folder target_folder
set name of file (target_folder & the_name) to target_name
end tell
tell application "Acrobat 6.0.2 Professional"
--activate
open (target_pdf as alias)
repeat with i from 2 to (count of component_PDFs)
open (item i of component_PDFs as alias)
set combined_page_count to (count page of document 1)
set source_page_count to (count page of document 1)
insert pages document 1 after combined_page_count from document 2 starting with 1 number of pages source_page_count
close document 2 saving no
end repeat
close document 1 with saving
--close all docs saving no
end tell
on error the_error
beep
set the_button to button returned of (display dialog the_error buttons {"Copy to Clipboard", "OK"} default button 2 with icon 0 giving up after 30)
if the_button = "Copy to Clipboard" then set the clipboard to the_error
end try