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.

Follow up: Automating BackBlaze Backup

This is a follow up to the original post "Automating BackBlaze Backup"

The last post has generated some interest among BackBlaze users. I received a few comments asking me to share the script I used to automate my BackBlaze Backup speed changing. Well time have changed a little. I improved my code a great deal. I am no longer using Automator as a helper, the code now is purely in Applescript. In the spirit of Creative Common, I am making the script available to the public. You can download it right here.

iPad Software Keyboard

I am always a fan of the traditional keyboards. I just think they feel better than the newer low profile laptop-style keyboards. So, when I purchased the iPad I thought I would not like the software keyboard on it.

However, as it turns out, it is quite good. Now, after about a week with my new iPad, I found myself mostly typing on the iPad using the software keyboard instead of using a Bluetooth keyboard.

One reason why I like it may be because the software keyboard is always next ot the body of text I am working with. That means I can sort of use my peripheral vision to peek at the keys. If I can't feel the keys, I might as well look at them.

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

Automating BackBlaze Backup

I am learning Applescript recently. Combining Applescript, Automator and iCal, I solved a problem that has bugged me for a long time. Currently, I am using a service called BackBlaze for off-site backup. The software that controls BackBlaze can control the upload speed but it doesn't have upload speed scheduling. I was controling BackBlaze's upload speed manually, but that is very inconvenient because the control is deep inside System Preferences on the Mac.

Then I looked around for ways that I could use Applescript to control BackBlaze. However, the BackBlaze software is not scriptable. Later, after some thinking, I had the idea of using the recording feature in Automator to create the part of the script that I needed to control BackBlaze. My idea worked perfectly this time. Now I am able to control the BackBlaze upload speed without digging through System Preferences.

I even created a schedule in iCal and set it to run the two workflows I wrote one for slow speed, one for full speed to let my computer control the upload speed automatically.