4

I would like the following behaviour of the Safari PDF Download button:

On clicking the PDF download button by moving the pointer to the bottom of a pdf/ps, the file is downloaded to the Downloads/ folder. Instead, I would like that to work as a "Save As" button so that I can save the pdf by a different name and in a location I prefer.

I know there is Cmd-S but I would like to use this as an opportunity to learn about Apple Scripts if that kind of idea can be used to solve this problem.

3 Answers 3

4

AppleScript on its own can't be used to 'hook' into other actions such as clicking certain things. There are tools available to run AppleScript on keyboard shortcuts, however you might as well use ⌘S in this case, or remap this shortcut with System Preferences → Keyboard. One cannot change the download location of the button in Safari preferences.

0
1

You will not be able to intercept the clicking action of a button using Applescript.

There are a couple of approaches you can use to achieve your goal.

1, Create an Automator Folder action to watch for pdfs file in the downloads folder. And Ask you where you want to move them.

2, Write an applescript that runs from the Applescript Menu or a Automator Service ...

Using the Applescript Approach I would get the url of the front window of Safari.

And then have my applescript ask me to choose where to save it.

For the downloading you may have to use some shell scripting like Curl in aApplescript Do shell script command.

Look at the Safari Scripting Library for details on accessing the url.

You can find out more about applescript and how to use it by looking at the Introduction to AppleScript Language Guide

1

Instead of using apple Script (that might not work for this) one can use the Automator.

It is rather simple Automator function.

All you do is reversing your steps.

You will still download using Safari defaults, but then the Automator will move the .PDF to a folder of your choice.

Here is a sample, just replace the .dmg to .pdf and choose the destination folder with the Move Finder Items's option to Show this action when the workflow runs

automator

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .