This Week's Sponsor:

Kolide

Ensures that if a device isn’t secure it can’t access your apps.  It’s Device Trust for Okta.


How To: Save Time with Dropbox and AppleScripts Launchers

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?

Unlock More with Club MacStories

Founded in 2015, Club MacStories has delivered exclusive content every week for over six years.

In that time, members have enjoyed nearly 400 weekly and monthly newsletters packed with more of your favorite MacStories writing as well as Club-only podcasts, eBooks, discounts on apps, icons, and services. Join today, and you’ll get everything new that we publish every week, plus access to our entire archive of back issues and downloadable perks.

The Club expanded in 2021 with Club MacStories+ and Club Premier. Club MacStories+ members enjoy even more exclusive stories, a vibrant Discord community, a rotating roster of app discounts, and more. And, with Club Premier, you get everything we offer at every Club level plus an extended, ad-free version of our podcast AppStories that is delivered early each week in high-bitrate audio.

Choose the Club plan that’s right for you:

  • Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with app collections, tips, automation workflows, longform writing, a Club-only podcast, periodic giveaways, and more;
  • Club MacStories+: Everything that Club MacStories offers, plus exclusive content like Federico’s Automation Academy and John’s Macintosh Desktop Experience, a powerful web app for searching and exploring over 6 years of content and creating custom RSS feeds of Club content, an active Discord community, and a rotating collection of discounts, and more;
  • Club Premier: Everything in from our other plans and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.