Another Useful Applescript (for moving files around)

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.)


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 ""

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

    --actually moving the file
    tell application "Finder"
        move input to to_loc
    end tell
end on

Step 5: Save the Service, give it a name like "Move to."

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.

Mobile Workspace

Currently I am using an iPod touch and an Apple bluetooth keyboard as my mobile workspace. In my opinion, nothing can replace the computer at my home office so there is no point trying. Traditionally, the concept of a mobile computing device is a laptop, which is just a slim down version of a desktop. The most important thing about a mobile workspace is, well, mobile. Laptops are big, in fact some are huge and heavy. But when you make them smaller, like netbooks, they become very difficult to use (small keyboard, small trackpad, etc) because all the softwares on laptops are designed for desktops. That's why I dislike the idea of bring a laptop with me. With the iPod Touch and Apple keyboard combo, I can solve both problems. I can have a small, hence mobile, device with me (this thing is smaller than my hand) while maintaining usability. The Apple keyboard is a full size keyboard and since the iPod Touch has a touchscreen, I don't even have to worry about the mouse/trackpad. It is true that the iPod Touch cannot perform a lot of the task that a laptop can, but, as I mentioned before, the point of a mobile workspace is not to replace the main office, but to augment it. If the task that you need to complete is so important that you need a laptop to do it, maybe you should do it in a quite environment like your office, and not out on the street with all those distractions