OmniFocus snooze script

Last Updated: 2010-06-15

Here’s an AppleScript that “snoozes” selected OmniFocus items by setting their start date to a future* value. These items will then be unavailable (and out of sight in views showing “available” items) until the snoozed start date.

Usage:

  1. Run the script with one or more items selected in OmniFocus

  2. Choose how long you would like to snooze the items (in # of days)

The script will then set the start date of selected items to the current date + the number of days selected in step 2. For example, snoozing with the default value of 1 day will set the tasks to begin at 12:00 AM tomorrow.

Finally, if you have Growl installed, the script will display a Growl confirmation.

I highly recommend initiating the script from a third-party launcher such as FastScripts or Quicksilver. This will prevent delays within the OmniFocus application due to Growl bugs.)

Download it here.


* This doesn’t have to be a future value. Choosing 0 as the snooze value will set the start date to midnight today; choosing -1 will set the start date to midnight yesterday.

NetNewsWire script: Subscribe to full-text feed of current subscription

Update Dec 2010: it looks like FullTextRSS is down. I’ll leave this up, but be forewarned: it probably won’t work. FiveFilters and WizardRSS provide similar services, so you may want to look there.

Here’s a script that attempts to subscribe to a full-text feed of the current subscription in NetNewsWire. It does this using EchoDittoLabs’ excellent FullTextRSS service.

To use, select a headline or subscription title in NetNewsWire and run the script. The full-text feed will appear in your top-level items.

Thanks to harvey.nu for the URL encoding routine. The script worked without the routine but it seemed safer to include it.

[Updated 2/22 with change suggested by Pascal.]

(*
Fulltextrss.scpt v 0.1b

Attempts to subscribe to the current subscription via
EchoDittoLabs’ FullTextRSS service (echodittolabs.org/fulltextrss)

Contains no error checking; use at your own risk

Dan Byler dbyler@gmail.com
*)


property fulltextpre : "http://labs.echoditto.com/projects/fulltextrss/?url="

tell application "NetNewsWire"
        if exists selectedHeadline then
                set this_headline to selectedHeadline
                set stdfeed to RSS URL of subscription of selectedHeadline
        else if exists selectedSubscription then
                set stdfeed to RSS URL of selectedSubscription
        end if
        try
                set theTextEnc to my urlencode(stdfeed)
                set fulltextfeed to fulltextpre & theTextEnc
                set theresult to subscribe to fulltextfeed
        on error
                display dialog "Oops—something went wrong."
                return
        end try
end tell

— urlencode routine taken from http://harvey.nu/applescript_url_encode_routine.html
on urlencode(stdfeed)
        set theTextEnc to ""
        repeat with eachChar in characters of stdfeed
                set useChar to eachChar
                set eachCharNum to ASCII number of eachChar
                if eachCharNum = 32 then
                        set useChar to "+"
                else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
                        set firstDig to round (eachCharNum / 16) rounding down
                        set secondDig to eachCharNum mod 16
                        if firstDig > 9 then
                                set aNum to firstDig + 55
                                set firstDig to ASCII character aNum
                        end if
                        if secondDig > 9 then
                                set aNum to secondDig + 55
                                set secondDig to ASCII character aNum
                        end if
                        set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
                        set useChar to numHex
                end if
                set theTextEnc to theTextEnc & useChar as string
        end repeat
        return theTextEnc
end urlencode

Download a copy here.

OmniFocus defer script updated

Updated 6/15/10: minor edit to improve efficiency

The updated Defer script for OmniFocus is ready. Changes include:

  • Bug fixes to make the script more reliable, particularly when deferring multiple items.

    • For most of these I’m indebted to Curt Clifton, who made the most critical bug fixes on the OmniFocus forum. (If you use OmniFocus, his scripts and tools are invaluable; be sure visit his site.)
  • The default action now defers both start and due dates.

  • Notifications code has been rewritten to make the script friendly for machines without Growl installed.

    • While testing, I discovered that GrowlHelperApp crashes on nearly 10% of notification calls. To work around this, the script now checks to see if GrowlHelperApp is running; if not, the script launches it. If Growl is not installed or can’t launch, the script displays a generic notification of the defer results.

If you experience delays with the script, it’s almost certainly an issue with Growl, not OmniFocus. This is much less of an issue if you launch the script via a third-party utility like FastScripts, because any Growl-related delays will be absorbed by the script launcher, not OmniFocus. If you primarily invoke the Defer script from your OmniFocus toolbar, you can always disable alerts to speed things up. To do this, simply open the script in Script Editor and change property showAlert to false.

Download it here.

Archive newsfeeds in DEVONthink Pro via NetNewsWire

Newsfeeds provide an invaluable service: direct access to content of specific interest. NetNewsWire has long been my preferred newsreader, and the recent addition of synchronized online access makes it, for me, the clear best-in-class news client. Yet although NetNewsWire does a fine job aggregating news feeds, it’s a poor long-term information management solution.

Enter DEVONthink Pro, a highly reviewed research tool/information manager.

The NetNewsWire > DEVONthink bridge is a logical one, so it’s no surprise that DEVONthink Pro comes with preloaded scripts to archive information directly from NetNewsWire. (Sorry, DEVONthink Personal doesn’t include scripting support.) But the feature I really needed – the ability to archive entire RSS feeds into DEVONthink – is not included in these scripts.

To fill this gap, I wrote a script to archive entire newsfeeds (or subsets thereof) to DEVONthink Pro.

This script saves items from your selected feed (or folder of feeds) to DEVONthink Pro as web archives, with the following options:

  • From the selected feed, folder, or smart folder, save:

    • All items

    • Flagged items

    • Unread items

    • Read items

    • Date range (archive all items within a specified date range)
  • Archive options:

    • Feed saves just the content of the news item (typically the best option if the site provides full-text feeds)

    • Site saves the content of the item’s target website (this should be the whole article – particularly useful if the newsfeed is truncated)

    • Site/Print goes to the item’s target website and looks for a link that includes the string “Print”. If one exists, it saves the print-ready page to DEVONthink. If none exists, reverts to “Site” behavior.

  • Perform post-archive actions: mark read, unflag, or do nothing. This action occurs after DEVONthink has archived the article, so you can see archive progress in action and ensure you don’t double-archive an article

  • Optional: introduce a random time delay between archiving articles if using “Site” or “Site/Print”. (Useful if the site you’re reading from has countermeasures to prevent content scraping. Read: if they’re trying to keep you from saving their content for later use.)

My personal workflows for this script:

  • Flag items of interest from all newsfeeds. Then run this script periodically to import all flagged items into DEVONthink. Archive target: Flagged items (feed); Post-archive action: Unflag.

  • Save full-text content of a magazine I subscribe to but don’t want to keep hard copies of. Run this script every week, when the magazine’s RSS feed is updated. Archive target: unread items (Site/Print); Post-archive action: Mark as read.

Get the script here.

Update 2008-08-12: Added an additional Growl-free script to the download for users who don’t have Growl installed. The only difference is that the lines referencing GrowlHelperApp are commented out. Same download link applies.

Update 2010-05-26: Fixed a problem encountered when news items don’t have a description. Added an option to archive items from a specific date range. The download link has been updated.

Brainstorm in XMind, work in OmniFocus

It’s the best of all possible worlds! Now you can brainstorm in XMind and import directly into OmniFocus via Udo Gaetke’s clever AppleScript. The script creates a project from your map’s root node and actions (or subactions) from the other nodes.

Thus, this:

XMind plan

Becomes this:

OmniFocus Plan
Via Skitch

Get the script here (forums.omnigroup.com)

Notes:

  • Although XMind isn’t scriptable, the XML file format is open; his script digs into the XML structure to pull relevant data

  • The script contains a property called import_folder. You’ll need to create a folder in OmniFocus with this name before running

  • The script contains a “rm -f” operation. This deletes a temporary XML file created by the script. You may want to peruse the script yourself before running

Get Newsfeeds via Safari and NetNewsWire – script updated

NetNewsWire often does a good job finding the newsfeed of a site — but it does sometimes choke.

The updated script will still attempt to get the newsfeed straight from NNW. If NNW has instant success, the script will display the feed and offer to copy it to your clipboard:

Success

After one second, if NNW was unsuccessful, the script will direct Safari search for the feed. The searches initiated (in new tabs, of course) include Google (“site:x rss OR subscribe”) and RSS Micro.

Quick note about RSS Micro: unlike most blog search engines (Google blog search included), it provides direct links to the relevant feeds. Just click on the RSS icon:

RSS Micro

Finally: the download includes a script that initiates these searches from Safari without invoking NetNewsWire. Useful if you don’t use NNW or don’t want to open it.

Download here.

Find URL feed via Safari and NetNewsWire

Guy Kawasaki asked for quick ways to find the RSS feed of a web site. NetNewsWire does a fine job subscribing to sites so I thought it might be up to the task. It is.

Run this to pull the current website from Safari, subscribe in NetNewsWire, and return the RSS feed URL, optionally copying it to the clipboard.

tell application "Safari"
        set thisPage to do JavaScript "document.URL" in document 1
end tell
tell application "NetNewsWire"
        activate
        set subcount to (count of subscriptions)
        set theresult to subscribe to thisPage
        delay 2  --gives NNW time to retrieve the RSS feed
        set thefeed to RSS URL of subscription (subcount + 1)
        if thefeed is equal to thisPage then
                display dialog "No feed found"
                return
        end if
        display dialog thefeed buttons {"Clipboard", "OK"} default button 1
        if the button returned of the result is "Clipboard" then
                set the clipboard to thefeed
        end if
end tell

Click here to open the script and give it a whirl.

Update: Renamed “NetNewsWire 3” to “NetNewsWire” since that’s what the app is called when you download it.

Also, NetNewsWire takes a split second to work its magic. If the script isn’t working for a site, try increasing the “delay 2” line to “delay 5” or something.

OmniFocus Defer Script

OmniFocus rocks. I can’t really imagine managing myself personally or professionally without this tool. Nevertheless, despite thousands of hours of development and beta testing, it has its share of quirks. Notably, in my work I have a few daily-type tasks I set to repeat every day. Unfortunately, there’s no “workday” option in the repeat choices, so every weekend I end up with a Saturday and Sunday repetition. I could either:

  • Mark them complete (ignoring the fact that I’ve just claimed to have done nonexistent work);
  • Mark them complete and delete the “done” items before they disappear (solving the first issue)
  • Change the start/due dates in the Inspector (cumbersome)
AppleScript to the rescue.

My Defer script allows you to defer, or ‘snooze’, selected projects or tasks by a given number of days. (Disclaimer for GTD pedants: my use of the word “defer” here is sanctioned by the New Oxford American Dictionary, not David Allen.)

Usage: Select the task(s) and/or project(s) you wish to defer. Invoke the script from the toolbar or script menu:

OFDS_1

Enter the number of days to defer the items in the resulting dialog box and select “OK” (default is 1, so feel free to just hit Return to ‘snooze for a day’).

OFDS_2

The script will then prompt you whether to defer both start and end dates of the items. “Due [date] only” is the default option, so again, feel free to hit return to snooze your due date only.

OFDS_3

Finally: a Growl notification to signify your success. (If desired, you can use a standard OS alert dialog or no alert at all. See the script for details.)

OFDS_4

Download here.

19 Feb 2009: version 0.2 is now available. Release notes here. Download link is for current version.

Quickly file Exchange-based emails using Entourage

Managing the torrential flow of work email used to be an onerous task, but a healthy combination of email habits and scripts simplify the flow greatly. Personal experience has demonstrated that email is best handled with a GTD-inspired triage system, à la this one. Spotlight on the Mac and Copernicus on Windows make dredging up old emails a cinch.

Even with a simplified organization structure, it can be time-consuming (or RSI-inducing) to triage your inbox. I find that when it takes longer than a second or two to file an email, I’m more likely to just leave it in my inbox — defeating the value of the system.

Although Outlook in Windows is my preferred professional email client, I use Entourage for email triage because it’s just faster. With a few simple Applescripts, filing any number of emails is a single keystroke away.

property destFolderName : "@ACTION"
property exchangeAccountName : "CHCSII"


tell application "Microsoft Entourage"
        set destFolder to folder destFolderName of Exchange account exchangeAccountName
        set currMsgs to (current messages)
        move currMsgs to destFolder
end tell

Save the script as “Action \ca.scpt” in your Entourage Script Menu folder (located in ~/Documents/Microsoft User Data/) and you can activate it instantly with Control-A. Change the “\ca” suffix to change the shortcut.

Bonus #1: Change your Caps Lock key to Control in the Keyboard & Mouse control panel (under “Modifier Keys…”) and the script is even easier to activate.

Bonus #2: If you have Growl installed, add the following code below “end tell” in the above script and you’ll get an unobtrusive confirmation that your email has been filed in the right folder (useful for the oh-shoot-did-I-just-move-that-to-the-right-folder moments):

tell application "GrowlHelperApp"
       
        set the allNotificationsList to {"General", "Move message", "Error"}
        set the enabledNotificationsList to {"General", "Move message", "Error"}
       
        register as application ¬
                "Entourage AppleScripts" all notifications allNotificationsList ¬
                default notifications enabledNotificationsList ¬
                icon of application "Microsoft Entourage"
       
        --      Error Notification...
        if (count of currMsgs) is 0 then
                notify with name ¬
                        "Error" title ¬
                        "Error" description ¬
                        "No message selected." application name "Entourage AppleScripts"
        end if
       
        --      1 Notification...
        if (count of currMsgs) is 1 then
                notify with name ¬
                        "General" title ¬
                        "Exchange Notification" description ¬
                        "1 message moved to " & name of destFolder application name "Entourage AppleScripts"
        end if
       
        --      Multi Notification...
        if (count of currMsgs) > 1 then
                notify with name ¬
                        "General" title ¬
                        "Exchange Notification" description ¬
                        "" & (count of currMsgs) & " messages moved to " & name of destFolder & "." application name "Entourage AppleScripts"
        end if
       
end tell