Custom refresh of NetNewsWire with AppleScript
January 16th, 2008
I’ve switched to mac just recently and haven’t yet found the alternatives for all the windows tools. I’ve been trying Newsfire for some time and I’ve been somewhat satisfied with its performance. But since I’ve discovered Wilmott Forums RSS feeds I was having problems with Newsfire - it doesn’t change status, nor in any other way acknowledge small item updates. And as Wilmott goes with the one-item-per-thread model, so that the item just contains the date of the last post, it was more or less useless for with Newsfire.
Then NetNewsWire went freeware, so I decided to give it a try. It has a useful feature - “mark updated items as unread” while also sorting the items by the last update time, which is more or less what I need. Although, I need to say that it doesn’t mark items as unread after tiny updates - as on Wilmott, so it’s not ideal. One other problem with NetNewsWire is that the minimum refresh time is set to 30 minutes. While it might be acceptable to most feeds so as to not get distracted all the time, I want to get faster wilmott updates. Well, when there’s a will, there’s a way. And this way is called AppleScript.
Skip down for new beta of custom refresh app
The first, and by far simpler, way is to use a script. It’s pretty straightforward - just open up Script Editor and insert
tell application "NetNewsWire" to refreshAll
delay 300
end repeat
I’ve settled on 300 seconds for delay time, but whatever one wants. Now, running the script manually, looks like a chore and it still shows up as a window. So, to improve it, we can do File->Save As->application bundle. Still not much improvement so far, we can’t even quit the app. But we don’t really need it if we hide it. And it can be easily achieved by adding to /NameOfApp.app/Contents/Info.plist
<string>1</string>
This key tells the app to work in background/dockless mode, which is precisely what we need. The cpu usage is quite modest indeed, so we can just add it as a Login item and all’s done. The NetNewsWire now refreshes as fast as we want it too.
The second way is for those who just need to be able to stop refreshing without resorting to Force Quit. It’s a bit harder, and involves using XCode.
The standard way to automate actions in Os X so far seems to use Automator, and NetNewsWire is no exception. Unfortunately, the number of actions available is rather limited, and no refresh/refreshAll action available. But we can create a new action on our own. To do this, simply do
XCode->New Projects->New AppleScript Application. Now the files we need are main.applescript, Info.plist, InfoPlist.strings. The script is just
tell application "NetNewsWire" to refreshAll
return input
end run
Now, if we switch to Release mode and build the app, the only thing left to install the action is to copy from project directory to either /Library/Automator or ~/Library/Automator. It will show up in Automator but as a separate action unrelated to NetNewsWire, it will work, but it does annoy a bit. That’s why we’ll need Info.plist - we change AMApplication key to
<string>NetNewsWire</string>
And that’s all we need to do for the app to show under NetNewsWire. To clean up things a bit, we can also edit InfoPlist.strings
/* AMDescription localized strings */
AMDSummary = "Refresh all feeds";
Everything else there is irrelevant for our purpose.
The only thing left is just to create an Automator workflow of the format:
- NetNewsWire-> _our new action to refreshAll in NetNewsWire_
- Automator->Pause
- Automator->RunWorkflow
Now we can save the workflow as application and apply the same trick with LSUielement. The only difference is on the menu bar

We can stop it at any time by pressing the red button. The disadvantages with this approach is 5-10 times bigger cpu usage(well, under 1% still) and clutter on the menu bar - but whatever one prefers…
You can download both apps here - script RefreshRSS and Automator RefreshFeeds
Thanks to a request from Theodora I’ve tried to improve the script a bit to allow for custom subscription refresh. It’s beta for now, so any comments are highly welcome, though it should work ;) So, what’s in the Refresher.app? It’s still just a script as RefreshRSS but with a few tweaks. Upon launch you’ll get a dialog in NetNewsWire asking

If you click yes, then you’ll get a list of all your subscriptions where you need to choose the one you wish to set/change the refresh rate, it looks smth like this

If you select the subscription you haven’t previously set the refresh rate for you’ll just get a dialog box

The default value is 5 minutes; pressing ok will bring you again to the dialog box asking if you want to add another refresh rate.
If for whatever reason you want to change the refresh rate for subscription you just select it from the list and get a dialog box like

That’s pretty much it. For technically oriented, this is pure AppleScript, all the details of your subscriptions are stored in ~/Library/Preferences/Refresher.info in format “Subscription:refresh time” on every line.
You can get it here : Refresher.zip
p.s. If you are getting error message “file Macintosh HD: … is already open” then this means that app crashed earlier and you’ll have to reboot to close it properly. Anybody knows how to close file opened with open for access under applescript for that matter?




