Being a blogger, I’m totally into finding new tools that allow me to save time. But who knew that the solution this time lied in Mac OS itself?
Today I’d like to talk about these new “apps” I’ve created thanks to AppleScripts.
Enjoy! ;)
Dropbox Custom App
The first one is a simple, yet powerful, Dropbox custom application based on AppleScript language.
Basically, it’s an app that sits into your dock waiting for some files to be dragged over. As you’ll drag and drop a file over it, the app will copie it into the Dropbox->Public directory, generate the url and paste it into the clipboard.
This means that if you have to share a large file (let’s assume more than 5 MB) you just have to perform a quick and easy drag & drop and wait for the upload to be complete (a few seconds in my case, but depends on your internet connection).
I call this a “Dropbox launcher”. To create this app, follow these steps:
- Fire up AppleScript Editor, located into /Applications/Utilities;
- Copy this code: (without the quotes)
“on splitText(delimiter, someText)
set prevTIDs to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to delimiter
set output to text items of someText
set AppleScript’s text item delimiters to prevTIDs
return output
end splitText
on open {dropped_item}
set myPath to (path to home folder) as string
set myPath to myPath & “Dropbox:Public:”
tell application “Finder” to duplicate (dropped_item) to folder (myPath as string)
set fileName to item (count splitText(“:”, dropped_item as text)) of splitText(“:”, dropped_item as text)
set filePath to “https://dl.getdropbox.com/u/1083712/” & fileName
tell application “Finder” to set the clipboard to filePath as text
end open”
- Replace “https://dl.getdropbox.com/u/1083712/” with your Dropbox public folder url; (Attention! The code assumes you have Dropbox on your Mac installed in its default position)
- Save the script as an Application;
- Place it into your dock and start using it.
That’s it. As you keep using it, you’ll notice that it’s an incredible time saving hack, totally worth messing a little bit with AppleScripts. (thanks to Ben Cardy for the tips)
AppleScripts Launchers
This one is very easy to acheive. With AppleScript, you can tell an application (or a bunch of apps) to activate and - guess what - the language is very simple!
Indeed, with this snippet:
tell application “Mail” to activate
Mail.app will launch (if quit) or go on top if inactive. And please note, this method works with every app. So, you can create an application which - with one click - will open as many other apps you wish and then will close again.
See my screenshot:
I’ve built a simple launcher called “Morning Coffee” which opens NetNewsWire and Tweetie, the apps I launch each morning after I wake up. To create the app, you just have to save the script as “application” as you did before with the Dropbox custom app.
Obviously, you can add a custom icon manually or with 3rd party apps like Candybar.
And you? Have you found out other ways to speed up your workflow with AppleScript?