This Week's Sponsor:


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

Posts tagged with "applescript"

Automatically Save An OmniFocus Project As iThoughts Mind Map

Automatically Save An OmniFocus Project As iThoughts Mind Map

After I posted about my OmniFocus > iThoughts mind-mapping workflow, several readers asked whether it’d be possible to only convert a specific section of OmniFocus to iThoughts format (as well as plain text and OPML). As Robin Trew, creator of the script, explains in the Help section:

Specify a sub-tree by the OmniFocus id of its root node. Defaults to None.

You can, in fact, slightly modify the script  by adding an -a switch and the ID of a particular project to restrict the query to that project and its subtree. This will work if you only want to export a specific Project to mind-map; Contexts have a different subtree structure in OmniFocus’ database.

For instance, I only wanted to create a mind map for my MacStories project. To do so, I control-clicked on the project in the app’s sidebar, and selected “Copy As Link”; this will give you an OmniFocus URL like omnifocus:///task/oREye1BBxdg. The ID is the alphanumeric string after /task/.

Follow my tutorial, and add the -a switch as an additional filter:

python $HOME/ --output=$HOME/Dropbox/Maps/MacStories -m map.itm -c '0' --format=itmz -a oREye1BBxdg

Make sure to check out Robin’s script, as it’s much improved since the original release. You can also visit Robin’s website (and follow him on Twitter) for several AppleScript-related custom scripts and resources.


Convert URLs to Tweetbot Links

I communicate with my team through iMessage. We’ve tried many “communication services” over the years, yet, since last Fall, we’ve always come back to Apple’s solution. It’s not perfect for us, its reliability is far from 100%, but it works.

As we keep using iMessage every day, there’s one category of “media” we’re constantly sharing: Twitter URLs. We find some cool piece of information or news on Twitter, we share it with the team. Linking back to tweets has, in a way, become our favorite type of commentary for fun, news-hunting, and everything in between. URLs, though, aren’t the best way to jump back to a tweet, especially when you’re on a mobile device. When you’re on a Mac, clicking on a Twitter link will open a new browser tab, which doesn’t really bother us as we’re used to opening background tabs on our computers. But on the iPhone and iPad, it can become annoying: there’s a limit of 8 Safari tabs on the iPhone, you get yanked out of Messages, and, most of the time, URLs just don’t work. In our team chat, we’ve speculated the “Not Found” errors we’ve seen may be related to how Tweetbot generates Twitter URLs when you hit “Copy Link to Tweet”: instead of using status in the URL slug, it uses statuses, which seems to be the reason behind erroneous redirecting on mobile devices.

We’ve come to the conclusion that we want to be able to easily copy URLs and turn them into links based on Tweetbot’s URL scheme. Using a simple tweetbot:// URL, you can use Twitter’s status ID – the same you receive when you copy a link – to open a single tweet directly in Tweetbot. And the best part is, the same URL scheme works consistently across Tweetbot for iOS and Tweetbot for Mac. As everyone on the MacStories team is already using Tweetbot, the solution seemed obvious – plus: no more browser tabs.

The problem was finding a way to convert URLs easily, without having to remember complex combinations of keystrokes and commands. Furthermore, as I promised my team I’d come up with a way, I had to figure out a solution to do text conversion directly on iOS.

As a result, I’ve come up with an AppleScript, a Keyboard Maestro macro, and a simple Python script to transform Twitter URLs into their Tweetbot counterparts. Read more

Send Selected OmniFocus Task to Plain Text File

I save a lot of stuff into OmniFocus: bits of text, URLs, emails. I used to save favorite tweets into it, too. The app’s Quick Entry panel is so easy to invoke and so well-integrated with core parts of OS X  that, most of the time, I find myself clipping information that shouldn’t be into OmniFocus at all. However, I also find the process of manually going through that information beneficial to my workflow: it allows me to mentally and practically separate actionable items (tasks) from things to read and things to write (Instapaper material and my future articles, essentially).

I have created a simple AppleScript to send the selected OmniFocus task to a text file. The script is meant for how I use OmniFocus; hopefully you’ll find it useful as well. Feel free to modify it.

Typically, when I decide to go through my OmniFocus inbox, I find a lot of tasks that are actually ideas of things I want to do or write. Ideas don’t go into OmniFocus. Until those ideas become actionable items, I send them to a text file so I can elaborate on them and see if they can evolve. Like I said, most of the time those ideas are for new articles.

I store all my notes in a single Apps/ directory on my Dropbox. Based off the same AppleScript, I have created a Keyboard Maestro macro to create a new text file for each processed task; this is for ideas I know will turn out to be single, standalone articles. For ideas I’m not so sure about, I prefer to append them as text to an Ideas.txt file I keep in Dropbox as an “everything bucket” for inspiration. Read more

Automatically Send Articles From Reading List to Instapaper

Two days ago, Ben Brooks asked on if anyone had come up with a way to share Safari Reading List items to Instapaper. His question made me realize that it would be a fun project to find out, so in my free time I put together a workflow that runs automatically and in the background on my Mac mini.

Please note, what follows is a raw experiment. I have tested it, and it works, but it’s far from stable. It uses GUI scripting in AppleScript to mark Reading List items as read, and it heavily depends on iCloud, which, unfortunately, is far from reliable when it comes to bookmark syncing. Nothing should happen to your bookmarks (the script simply “reads” them), but backups are recommended, as usual. Read more

Send Flagged Mail Messages To OmniFocus Automatically

Send Flagged Mail Messages To OmniFocus Automatically

Sven Fechner pointed today to an AppleScript published in late 2011 by Hunter Hillegas to send flagged messages to OmniFocus’ inbox on the Mac.

In iOS 5, Apple added the ability to flag a message, just as you’ve been able to do on the desktop forever. I created an AppleScript that looks for flagged messages. When it finds them, it adds them to OmniFocus and links them back to, just like the Services action does. It then also unflags the message, resetting the state back to normal. This script runs every five minutes.

In iOS 6’s, it’s now even easier to mark a message as flagged. I have tried the script, and it works as advertised. I would modify it to include only the latest message of a thread in the task note, but I see the appeal of having an entire conversation saved in OmniFocus for reference.

Obviously, the script is best enjoyed if executed on a Mac that’s running all the time. In this way, you can set a message as flagged on iOS, wait a few seconds, and find it in OmniFocus right away.

Personally, I run my own OmniFocus sync (every minute) so that I always have up-to-date sync that I can control. To implement this script in my workflow, I just had to create a new Keyboard Maestro macro (pictured above) that runs the AppleScript every minute if I’m logged in. In the way the script is designed, flagged messages are processed, then set back to “unflagged” so they won’t be added again in the future (unless you flag them manually).

You can find the AppleScript here.


Notifications Scripting Lets AppleScript Display User Notifications in Mountain Lion

Notifications Scripting Lets AppleScript Display User Notifications in Mountain Lion

In the past months, a few ways to enable AppleScript to display user notifications in Mountain Lion have surfaced online. Our own Don Southard wrote a test app using AppleScriptObjC; Ben Waldie put together an Automator action for Notification Center; terminal-notifier lets you send user notifications from the command line.

Notifications Scripting (via MOSX Tumbelog) is a new entry in this scene, and it looks like a simple yet powerful addition that could be easily integrated into other AppleScripts.

Notifications Scripting is a GUI-less application that can be only used with AppleScript. This application allows AppleScript scripts to display user notifications in OS X Mountain Lion and handle the user interactions with these notifications.

The best part of Notifications Scripting is its dictionary. It contains definitions for the notification messages of course, but also for notifications that have been delivered and activated. In the code sample provided by the developers, a dialog is displayed in the Finder following a user notification. You can imagine how this tool could be integrated with scripts that prompt users for input or allow for multiple choices from a set of actions.

You can download Notifications Scripting here.


Visualize OmniFocus As iThoughts Map, OPML, Or Plain Text

iThoughts for OmniFocus

iThoughts for OmniFocus

A few weeks ago, Michael Schechter found a way to export an OmniFocus for Mac database to OPML to visualize it in mind-mapping apps like iThoughts and MindNode. In the post, he wrote that, however, he was reaching to the Mac community to see if anyone would be able to build a more powerful and reliable solution with filters, color options, and more control on the exported data. RobTrew picked up the task and, on the OmniGroup Forums, released an initial script to export from OmniFocus to OPML.

Then, yesterday, Rob released a new version of the script which adds native iThoughts support and plain text exporting options, as well as settings for colors, templates, and filters.

I tested Rob’s script with my OmniFocus database, and after several improvements he made to the script, I feel comfortable enough with linking to it here. Unlike other solutions, Rob’s script looks directly into the SQL OmniFocus database cache to get its data – quite a feat on its own. But there’s so much more the script can do if you start customizing it. Read more

Create OmniFocus Tasks From Drafts, Scratch, Or Any Text Editor Through Dropbox

Back in October 2010, I posted a tutorial on how to add new tasks to OmniFocus or Things using Dropbox, AppleScript, and PlainText by Hog Bay Software. In June 2011, I wrote about more ways to add tasks to OmniFocus (my GTD app of choice), and noted how I had only “scratched the surface of what’s possible to do with OmniFocus and task creation”.

I decided to slightly revisit my workflow now that several “quick Dropbox note-taking apps” like Scratch and Drafts have come out. These apps are already integrated in my daily routine, but the following method works with any text editor, and, obviously, using Dropbox is recommended if you want to be able to create tasks from anywhere. Read more