Getting Safari to work with files in specified Directories

I have a script that checks picture status via Safari in a Magento web site developer interface. If it logs the fact that the page is in need of a picture, it uses a previously articulated Token (which happens to be the file name of the asset needed, minus the “.jpg”) to Browse for the picture. I would like the script to be able to handle this step by FORCING Safari to get the asset from a specific Directory, mainly because there are multiple versions of the asset across all my currently connected drives.

Currently, I have the script pause to wait for ME to select the file then click OK in the Safari dialog that chooses it. I want this to be able to do this step unattended, so that I can then loop it through a list of similar actions.

Can this be done?

Most likely, but you will need to post your script/macro.

Hey Bill,

I’m assuming Safari is using a normal Open dialog for this task – yes?

When the dialog is opening:

  • Pause Until the [Open] button exists.

  • Simulate G

  • Pause until the [Go] button exists.

  • Paste your desired path into the “Go to the folder:” field.

  • Select the [Go] button.

  • Continue…

Fairly simple and fairly fast.

If you want less simple but faster you’ll need to own a copy of Default Folder and script it.


Thanks I will try this. And I do own and use Default Folder.


Hey Bill,

In that case you can make things smoother and more organic by scripting Default Folder.

AppleScripting Default Folder