Don’t Forget Your Chores: Empty the Trash!

If you find your self forgetting to empty the trash on a regular basis, why not automate it? The following applescript can be used to do just that.


tell application "Finder"
empty the trash
end tell


Alternatively, if you wanted to execute the cleanup from a shell script, or a one liner in your crontab, the following one liner could be utilized:


osascript -e ‘tell application “Finder” to empty the trash’


NOTE: In contrast to the command driven instructions represented in the Wikipedia article above, a nice GUI alternative is CronniX.

Folder Action: Moving Files and Keeping Organized

Folder actions are a nice way to save yourself mouse clicks and keystrokes. The applescript below, when assigned to your “Desktop” folder, will move all new torrent files to a subfolder named “torrents”. Now when you download .torrent files from your tracker of choice, you can let Safari, or Firefox, save the file to it’s default location, which is usually the “Desktop” folder. When the file is written to disk, it will be automatically moved for you, keeping your workspace nice and organized.



property fdest : “torrents”

on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
tell application “Finder”
if (name of eachitem ends with “.torrent”) then
move eachitem to folder fdest
end if
end tell
end repeat
end adding folder items to


The above applescript can easily be tailored to organize other types of files, such as pictures or music. Remember, a cluttered environment leads to a cluttered mind.

Off Topic : Bad Business Decision

DSC00021 Irony is a wonderful thing! I guess, with a store name like “Chapter 11 Books”, you’re doomed from the beginning.

A camera phone has never been more convenient!

Click the thumbnail for a higher resolution version.

Wednesday One Liner

Are you a fan of growl? You should be, because it is an amazingly useful application. Have you ever wanted to know how to send yourself a custom growl notification? It turns out, that when you install growl, it supplies a command line utility that you can use to generate notification messages. You can use the following snippet in a shell script to send yourself a custom message:


growlnotify -m “test message”


Many more command line options are available for growlnotify. To see a summary of all the available options:


growlnotify -h

Mail Plugins Rock!

Apple Mail is a wonderful application with a well rounded feature set. Having said that, it doesn’t always fill every email need. If you find Mail lacking in some specific way, perhaps one of the many available plugins can fill the void.

One of the best resources on the web to find Mail plugins, both free and commercial, can be found here.

This site, while nice, is obviously no match for Hawk Wings, which continues to be an indispensable resource for all your Mail.app needs.

Enjoy!

Volume Control

Adjusting the audio volume via applescript can be very useful. Here’s how to raise the volume on your system 10 notches (out of 100):

 -- volume up 10
 set current_volume to output volume of (get volume settings)

 if current_volume is less than 100 then
 	set current_volume to current_volume + 10
 end if

 set volume output volume current_volume

If you are using a using a keyboard that isn’t designed for the Mac and doesn’t have functioning multimedia controls, variations of this script can come in handy when assigned to keyboard shortcuts.

Sunday Shortcut: Finder

If you are working in the Finder, and know the exact location you wish to browse to, the following shortcut will pop open dialog that will allow you to type in your destination address. This is especially useful if you want to browse many levels deep in the directory hierarchy, or if you want to browse to a directory that is traditionally hidden in the Finder, such as /usr.


shift + apple + g


As an added bonus, while typing in your destination, if you hit “tab”, the Finder will attempt to auto complete the location for you. This functionality can be hit or miss. If the Finder doesn’t know where you are trying to go, or if the destination location is ambiguous, hitting “tab” will simply move input focus over to the “go” button. With a little training though, this functionality can really save time.



Follow

Get every new post delivered to your Inbox.