I would like to make an AppleScript that saves all of the open tabs in the front window in Google Chrome to a PDF.
Here is my working MWE so far:
tell application "Google Chrome"
set allTabs to tabs in front window
repeat with myTab in allTabs
tell myTab to print
end repeat
end tell
Of course, this simply opens the print window repeatedly for each open tab.
Ideally, I could save each one to a distinct PDF, something like this (using some made-up commands here):
tell application "Google Chrome"
set myFolder to "/Users/nnn/Desktop/PDF/"
set myCount to 0
repeat with myTab in allTabs
set myCount to myCount + 1
set fileName to "pdf" & myCount & ".pdf"
set outputPath to myFolder & fileName
export myTab to outputPath as PDF -- obviously, this does not work.
end repeat
end tell
How would I get this to work?