Mail.app script: Find selected messages in Fastmail

For Fastmail users who also use Mail.app, here’s a script that searches for the selected messages (in Mail.app) in the Fastmail web interface.

Why would you need such a thing? One reason is that Fastmail lets users specify an infinite number of aliases which they can give to an infinite number of websites (and subsequently block, if an infinite amount of spamming ensues). Mail.app doesn’t offer a good way to change your reply address, but replying from the Fastmail web interface does the trick nicely. (Thunderbird users can use the Virtual Identity plugin for this as well.)

Here’s the script:

--Searches for the messages selected in Mail.app using the Fastmail web interface
--By Dan Byler (http://bylr.net)

tell application "Mail"
    try
        set selected_messages to selection
        set remaining to count of selected_messages
        set the_url to "https://www.fastmail.fm/mail/?MLS=MS-*;MSS=!MB-*;SMB-CS="
        repeat with the_message in selected_messages
            set remaining to remaining - 1
            set message_id to the message id of the_message
            set the_url to the_url & "msgid%3A%22" & message_id & "%22"
            if remaining > 0 then set the_url to the_url & "%20OR%20"
        end repeat
        set the_url to the_url & ";SMB-SearchAll=on;MSignal=*P-1"
        open location the_url
    end try
end tell

Or download it here.

Today and Tomorrow (OmniFocus scripts)

11 July 2011: as described here, I’ve switched to a Start-based workflow and updated my scripts to reflect this change. By default, these scripts now set the start dates of selected items, not due dates—though you can still switch to “Due mode”. This post has been updated to reflect these changes.

I’ve added two more scripts to my OmniFocus repertoire: Today and Tomorrow.

As one might expect, Today sets the “Action Date” of selected item(s) to the current date, and Tomorrow sets the action date to the next date. (By default, the Action date is the Start date, but you can switch to use the Due date if you prefer.)

Why might you need this? A few days of ignoring OmniFocus is enough to make any date-sorted view overwhelming. My Defer script is one method to deal with these items: defer them by a day, a week, etc. But sometimes you just need to set these items to today. Or tomorrow.

As with Defer, these scripts work with any number of selected tasks.

If you use the default “Start” mode:

  • The Start date of each selected item is set to the current day
    • If an item has a previously assigned Start date, its original time is maintained. Otherwise, the start time is set to 6am (configurable in the script)

If you use “Due” mode:

  • The Due date of each selected item is set to the current day
    • If an item has a previously assigned Due date, its original due time is maintained. Otherwise, the due time is set to 5pm (configurable in the script)
  • If an item has a Start date, it is moved forward by the same number of days as the due date has to move (in order to respect parameters of repeating actions)

Putting it all together

I’ve set my keyboard shortcuts for Defer, Snooze, Today, Tomorrow, and This Weekend to ctrl-d, ctrl-z, ctrl-t, ctrl-y, and ctrl-w, respectively (using FastScripts), so shuffling tasks couldn’t be easier. Use cases:

Catching up after holiday: Select all overdue tasks, hit ctrl-t to bring them current. Then snooze or defer the ones you won’t get to today.

Planning today’s tasks: Select your tasks and ctrl-t them into the day’s queue. Planning tomorrow? Use ctrl-y instead.

Download them here

 

 


Thanks to Seth Landsman for his role in inspiring my Today script. His version is very similar but doesn’t quite match the defer logic I need.

Usage note: some items inherit due dates from their parent task or project, but don’t actually have due dates themselves. This script ignores those items.

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.]

[code lang=”AppleScript”] (* 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/applescripturlencode_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 [/code]

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.