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.

[code lang="AppleScript"]
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
[/code]

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.

[code lang="AppleScript"]
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[/code]

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):

[code lang="AppleScript"]
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[/code]