macOS Sierra Model 10.12.6.
Script-editor Model 2.9 (191).
Hey, I am attempting to scale back the dimensions of a number of pdfs, nevertheless the script under prompts error: line ending anticipated, however class identify discovered. The script additionally highlights line 19’s phrase doc.
-- Compress PDFs utilizing Preview's Quartz Filters
set quartzFilter to "Cut back File Dimension" -- Substitute together with your Quartz filter identify
set outputFolder to (select folder with immediate "Choose the folder to avoid wasting compressed PDFs:")
inform utility "Finder"
set pdfFiles to (select file of kind "PDF" with immediate "Choose PDF recordsdata to compress:" with a number of choices allowed)
finish inform
repeat with pdfFile in pdfFiles
set inputFilePath to (pdfFile as textual content)
set outputFilePath to ((outputFolder as textual content) & (identify of (data for pdfFile)))
inform utility "Preview"
open pdfFile
delay 1 -- Permit time for Preview to load the file
attempt
export doc 1 to file outputFilePath as PDF utilizing Quartz filter quartzFilter
shut doc 1
on error errMsg
show dialog "Error processing file: " & (identify of (data for pdfFile)) & ". Error: " & errMsg
finish attempt
finish inform
finish repeat
show dialog "Compression full!" buttons {"OK"} default button "OK"