DEV Community

Kazuya Matsumoto
Kazuya Matsumoto

Posted on

Never seeking downloads folder with apple script

How many times do you download something ever?

  • Download any new software
  • Download photos and icons
  • Download the file sent to you by email
  • ...etc.

And what is the one thing you must do after you download it?
That's right.

*Open the download folder! *

I'm sure I'll do it, I'd love to meet someone who doesn't open the download folder after downloading it 😜

I think most people do this, don't they?

  1. cmd + space to find finder
  2. select the download folder
  3. move or open files

This is such a hassle and a waste of time, isn't it?
This time, I'll show you how to automate the process of opening this download folder using apple script!

How to do it

This time, we'll use a feature called WatchingFolders in apple script.

About apple script itself, you can see here.

  1. First of all, you need to create an apple script by using the script editor, which is the editor of apple script. Just 5 lines of script will save your time.
on adding folder items to theAttachedFolder after receiving theNewItems
    tell application "Finder"
        open theAttachedFolder
    end tell
end adding folder items to
Enter fullscreen mode Exit fullscreen mode

Something like this.

open_directory_on_add_item_ and _Never_seeking_for_download_folder.png

To explain a little since this is a technical article, when a file is added to a folder, the event handler is called and the object of the folder is put into theAttachedFolder.

on adding folder items to theAttachedFolder
Enter fullscreen mode Exit fullscreen mode

to open that folder in the Finder.

tell application "Finder"
    open theAttachedFolder
end tell
Enter fullscreen mode Exit fullscreen mode
  1. Once the script is created, save it. At this time, it is important to note that you need to save it to one of the folders of
  • /Library/Scripts/Folder Action Scripts/ ## Available to any user
  • ~/Library/Scripts/Folder Action Scripts/ ## Current user only

The name can be anything, but this time I chose open_directory_on_add_item.
(If you don't have Folder Action Scripts, you can create your own one with the same name.)

  1. Apply the script to the Download folder after saving it.
    1. Control-click the folder in Finder.
    2. Choose Folder Actions Setup from the contextual menu.
    3. Choose a script to connect to the folder and click Attach. Folder action settings_and_search.png

Also make sure that Use Folder Actions is checked.

Folder Action Settings_and_Never_seeking_for_download_folder.png

We're ready to go!

Operation check

Finally, let's make sure it works!
I'm going to try to download some kind of icon, whatever it is.
Wombat - Free animals icons
The download folder should open automatically when it completes!

Now you're free from the pain of looking for the download folder! You have to try it!

Top comments (0)