I brought this up a while back on the old NNW Slack (good riddance). I would like to be able to programmatically get the selected feeds in NNW’s main window.
There are properties for current article and selected articles, and you can get the feed(s) of those articles. But this doesn’t let you get the current selected feed if there is no current article or no selected articles.
My use case (same as last time) as a script that opens the source for the current feed in BBEdit. When I asked about this a few years ago, Daniel Jalkut gave me a solution that worked using GUI scripting, but that solution has already broken. GUI scripting is so fragile. I’d rather avoid it. What I’ve got today is a script that works if and only if there is a current article visible in the main window
It’d be so much nicer if I could just get the selected feeds – that would let me select more than one feed and open the source for each of them with one call to the script.
Current script:
tell application "NetNewsWire"
try
set _article to get current article
end try
if _article is missing value then
display alert "No article selected." message "This script only works when there is a “current article” selected."
end if
set _feedURL to _article's feed's url
end tell
tell application "BBEdit"
activate
try
set _feedSourceText to do shell script "curl --insecure " & quoted form of _feedURL
make new text window with properties {contents:_feedSourceText, name:_feedURL}
select insertion point before character 1 of text window 1
on error err_msg
display dialog err_msg with icon warning buttons {"OK"}
end try
end tell