Reduce attention in NetNewsWire with AppleScript

There’s too much junk in my NetNewsWire so I’ve written an AppleScript to penalise time wasting feeds.

Many things interest me. As a result, over the last number of years, I have subscribed to feeds from way too many sources. Currently in NetNewsWire I have over two and a half thousand unread items. The only problem with this is the number of highly interesting items that I imagine I miss. They are lost in the crowd of items that are only mildly fascinating.

NetNewsWire provides a tool to help deal with this scenario. By choosing to sort by attention feeds I am more likely to value float to the top.

From the NetNewsWire manual:

How does NetNewsWire figure out attention?

It watches what you do with the items in each feed. If you flag items in a feed, send items via email, post to Delicious, or post to your weblog, it figures this feed is pretty important to you. The more you do those things, the more important is the feed.

After using this feature for some time, the feeds I interact with most frequently have made their way to the top of my subscription list. Trouble is, this system has significant bias towards feeds which carry the highest posting frequency. Although I may only be interested in a small percentage of the items in a particular rapid fire feed, it will likely rate higher than another feed with only sporadic updates; Even if I find most of them invaluable.

Unsubscribing from feeds is a solution, and I have been, but I’d rather do it based on evidence and so far attention score is the best measure I’ve got. For the attention score in NetNewsWire to better represent a feed’s relative value it needs some help from me. I need to penalise the time wasters.

Fortunately NetNewsWire provides a method to influence the attention score of a feed item as described in the Newsgator knowledge base:

How can I change the Attention Score of a feed?

You can adjust the score for a feed using an AppleScript script. Here are the details from the AppleScript dictionary for NetNewsWire:

“scripted attention score (integer) : To affect the calculated attention score, you can change the scripted attention score. The scripted attention score is a component of the calculated attention score (it’s added).”

The scripted attention score is a property of a subscription object. (Tip: to lower a score, make it a negative number.)

So I put together an AppleScript to Reduce Attention Score of the feed of the selected post:

tell application "NetNewsWire"
    if exists selectedHeadline then
        set thisSubscription to subscription of selectedHeadline
        set currentScore to scripted attention score of thisSubscription
        set scripted attention score of thisSubscription to currentScore – 1

        set growlDescription to "Score reduced to " & calculated attention score of thisSubscription

        tell application "GrowlHelperApp"
            register as application "NetNewsWireScore" all notifications {"Attention"} default notifications {"Attention"} icon of application "NetNewsWire"
            notify with name "Attention" title "Attention" application name "NetNewsWire" description growlDescription icon of application "NetNewsWire"
        end tell

        tell application "System Events" to keystroke "+"

    else if exists selectedSubscription then
        tell application "System Events" to keystroke "+"
    end if
end tell

Incorportating NetNewsWire’s shortcut (to jump to the next unread item) for efficiency.

To install this script I suggest you copy-paste it into a new script file in Script Editor and save it with a meaningful title into ~/Library/Scripts/Applications/NetNewsWire/.

FastScripts made it easy to a assign a keyboard short-cut to launch the script. I assigned Option-Space, mostly for it’s memorable similarity to hitting the space-bar.

Including a Growl notification reassures me something actually happened when it runs.

While I was at it, I made another to Increase Attention score of the selcted post:

tell application "NetNewsWire"
    if exists selectedHeadline then
        set thisSubscription to subscription of selectedHeadline
        set currentScore to scripted attention score of thisSubscription
        set scripted attention score of thisSubscription to currentScore + 1

        set growlDescription to "Score increased to " & calculated attention score of thisSubscription

        tell application "GrowlHelperApp"
            register as application "NetNewsWireScore" all notifications {"Attention"} default notifications {"Attention"} icon of application "NetNewsWire"
            notify with name "Attention" title "Attention" application name "NetNewsWire" description growlDescription icon of application "NetNewsWire"
        end tell

        tell application "System Events" to keystroke "+"

    else if exists selectedSubscription then
        tell application "System Events" to keystroke "+"
    end if
end tell

To trigger this script I chose Command-space. So now when I have finished looking at a post in NetNewsWire I have three choices:

It will be very interesting to see what impact using this technique will make on my subsciption list.

Further thoughts

28 November 2009

After noticing an issue with these scripts where it was being triggered multiple times I’ve had a closer look and made some changes to them.

The + key is the proper “Next unread” shortcut to jump to the next unread item in NetNewsWire. Space-bar only does this if there is no more page scroll.

This change also stopped the unwanted looping. Generally I still had the Option key depressed when the space-bar key was evoked by the first version of the script, this re-triggered the script a number of times.

Also some a curiosity satisfying feedback to the Growl notification; The current calculated score of the modified feed.