Why This Script

The Applescript that I am sharing today is a Service that I created a while ago. The main purpose of this service is to move files quickly from one location to another. One problem that I enounter everyday is moving and organizating my downloaded and newly created files. (I like to place my working files on the Desktop then move them to the final destination after I am done.)

Tools

To create this script, you will need Automator and some knowledge in Applescript. It might be possible to achieve the same result using only Automator, but I think it will be more complicated for me as I am not very familiar with Automator.

How To Write The Script

Step 1: Open Automator and create a new Service workflow.

Step 2: Select what type of items the Service workflow will receive. Here we want it to move files and folder, so we need to choose "files and folders" in "Finder.app."

Step 3: Drag the "Run AppleScript" Action to the workflow.

Step 4: This is where the hard part comes in. You have type in the code that actually moves the files around.

on run {input, parameters} --define a list of predefined location you wish to move your files, --e.g. the "Applications" folder, etc. (shown here) --you can define as much location as you want set loc_list to {"Applications", "Documents", "Music"}

--display a prompt to let you choose a location from the list above --to move the file to set loca to (choose from list loc_list)

--set the actual path of the destination folder --when you add your own locations, you need to --add a new statement to define the folder path if loca contains "Applications" then set to_loc to "Mac HD:Applications:" end if

if loca contains "Documents" then set to_loc to "Mac HD:Users:hinyeungyu:Documents:" end if

if loca contains "Musics" then set to_loc to "Mac HD:Users:hinyeungyu:Music:" end if

How To Use The Script

You can run the script anywhere within Finder. For example, say you have a file on your Desktop and you want to move it to Documents. Just right click on file and you should see the "Move to" Service at the bottom of the contextual menu. Click on it and then choose the destination, in this case "Documents," when you are prompted. Click "OK" or press "return" and the file will be moved.