I frequently save pages as PDF from Chrome on OSX. The page is apple-P then click the PDF button and the "Save as PDF.." menu item. I always use the pre-filled filename and save in the default directory.

Is it possible to save this as an automator script? If that is possible I woulld sure like to add this as a button on Chrome somewhere so I can just "save this for reading later"

Thanks for any help.

link|improve this question
FYI, instapaper.com is an excellent service for saving webpages for offline reading. – ghoppe Mar 14 '11 at 16:53
Yeah I know of it, but do not want. I want a way of saving a web page as PDF at the moment. – dwatson Mar 22 '11 at 0:23
feedback

2 Answers

Use the Service template in Automator. Service receives no input in Google Chrome.app, workflow is Utilities > Watch Me Do, then perform your print action so it can be captured by Automator. (Chrome doesn't provide any Automator actions, but Watch Me Do only requires Universal Access.)

Alternately, you can use AppleScript, but working out exactly how to reference things can be "interesting" and I notice its dictionary doesn't reference the standard print settings type so you may not be able to control the Print dialog.

link|improve this answer
How can he record when using the Watch Me Do action explicitly? I only managed to do that with Workflow » Record, creating the Watch Me Do automatically. Also, he needs to be careful how Safari is activated, clicking on the window will associate it by name (Activate Window "google chrome - How to record a..." or something like that), it's safer to click the Dock icon. And I still have a hard time getting it to reproduce -- I guess it doesn't like an auto-hidden Dock or fast mouse movements. – Daniel Beck Mar 16 '11 at 6:37
that is what I am looking to do! It shows up in the Google Chrome Services menu, however it throws an error when I try and run it; "The Action 'Watch Me Do' had an error" The Watch me do action in Automator says: - Click the "File" menu. - Print... - Save as PDF... - Click the "Save" button PS - I didn't have to add the Watch me do action itself, mearly hit the record button on automator. – dwatson Mar 22 '11 at 0:17
feedback

If you assign ⌘P as the shortcut for Save as PDF..., you can open the dialog just by pressing ⌘PP. Here's an AppleScript that partially relies on that method:

tell application "System Events"
    keystroke "ppd" using {command down}
    tell (process 1 where frontmost is true)
        perform action "AXPress" of button "Save" of window 1
    end tell
end tell

I haven't bothered trying anything more complex myself, but you could take a look at MacScripter / Save as PDF – An attempt at a general-purpose GUI method.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.