Hello got this script working fine but would love to get it to work on a watched folder instead of asking you what folder you want it to run on. tried taking out the first bit of the script but then it doesn’t run. can anyone help. yea i am a newbie. below is the working code
-- Get list of PDF's
set Question to "Do you want to include all the subfolders" & return & "within your folder selection?"
set The_Dialog to display dialog Question buttons {"No", "Yes"} default button 1 with icon note
if button returned of The_Dialog is "Yes" then
set Input_Folder to choose folder with prompt "Where is the top level folder of PFD's?" without invisibles
tell application "Finder"
try
set File_List to (files of entire contents of Input_Folder whose name extension is "pdf") as alias list
on error -- only one file
set File_List to (files of entire contents of Input_Folder whose name extension is "pdf") as alias as list
end try
end tell
else
tell application "Finder"
set Input_Folder to choose folder with prompt "Where is the folder of PFD's?" without invisibles
try
set File_List to (file of Input_Folder whose name extension is "pdf") as alias list
on error -- only one file
set File_List to (files of Input_Folder whose name extension is "pdf") as list
end try
end tell
end if
set PDF_Count to count of File_List
if PDF_Count = 0 then
display dialog "Your folder selection contains no PDF files to print!" giving up after 2
end if
-- Loop through the list of files
repeat with this_file in File_List
tell application "Adobe Acrobat Pro"
activate
open this_file
tell active doc
set view mode to just pages
set zoom type of PDF Window 1 to fit page
delay 1
set MB_Size to media box of page 1 as list
-- Points to millimeters Conversion
set MB_Height to ((item 2 of MB_Size) / 2.834645) as integer
set MB_Width to ((item 3 of MB_Size) / 2.834645) as integer
-- Determine long & short edges
if MB_Height ≥ MB_Width then
set LE to MB_Height
set SE to MB_Width
else
set LE to MB_Width
set SE to MB_Height
end if
-- Count the pages this is to be used in the print range
set Page_Count to count of pages
set This_Fit to false
-- Fits on A5 paper (less printer margins)
if LE < 200 and SE < 138.5 then
set This_Fit to true
do shell script "defaults write com.apple.print.PrintingPrefs DefaultPaperID iso-a5"
delay 1
print pages first 1 last Page_Count PS Level 3 with binary output
end if
-- Fits on A4 paper (less printer margins)
if LE < 287 and SE ≤ 200 and This_Fit is false then
set This_Fit to true
do shell script "defaults write com.apple.print.PrintingPrefs DefaultPaperID iso-a4"
delay 1
print pages first 1 last Page_Count PS Level 3 with binary output
end if
-- Fits on A3 paper (less printer margins)
if LE < 410 and SE ≤ 287 and This_Fit is false then
do shell script "defaults write com.apple.print.PrintingPrefs DefaultPaperID iso-a3"
delay 1
print pages first 1 last Page_Count PS Level 3 with binary output
end if
-- Scale output to fit on A3 paper (less printer margins)
if LE ≥ 410 or SE > 287 then
do shell script "defaults write com.apple.print.PrintingPrefs DefaultPaperID iso-a3"
delay 1
print pages first 1 last Page_Count PS Level 3 with binary output and shrink to fit
end if
end tell
close active doc saving no
end tell
end repeat