Saving current NetNewsWire tab or headline as web archive

I just made a little AppleScript that makes an webarchive of the currently selected NetNewsWire tab or headline.

Just copy the following lines, open your script editor, paste it and save it in ~/Library/Scripts/Application/NetNewsWire/. The best way to trigger the script is using FastScripts.


tell application "NetNewsWire"
	set savedURL to ""
	set savedTitle to ""
	set userTab to (index of selected tab)
	if (userTab is greater than 0) then
		set tabURLs to (URLs of tabs)
		set tabTitles to (titles of tabs)
		try
			-- may fail if the targeted tab is, for instance, empty
			set savedURL to (item (userTab + 1) of tabURLs)
			set savedTitle to (item (userTab + 1) of tabTitles)
		end try
	else
		set myHeadline to ""
		set myHeadline to selectedHeadline
		if (isFake of myHeadline) is equal to false then
			set savedURL to URL of myHeadline
			set savedTitle to title of myHeadline
		end if
	end if
	
	tell application "DEVONthink Pro"
		set archive to create record with {name:savedTitle, type:html, URL:savedURL}
		set data of archive to download web archive from savedURL
	end tell
end tell

The script is only tested with DevonThink Pro 1.3b2.
I hope someone will find it useful.

SuWEEET!

I’ve used the other script for getting the feed in for a long time now, but had been dragdropping the tab url. Now more fun!

It works great, and thanks for posting!

You’re welcome. :smiley:

After reading this topic, I’ve expanded the script.
You can now specify a group to which the webarchive will be saved.
Just modify the string “/RSS” to any name you like.


-- Specify your default incoming group name 
property pDestinationGroup : "/RSS"

tell application "NetNewsWire"
	set savedURL to ""
	set savedTitle to ""
	set userTab to (index of selected tab)
	if (userTab is greater than 0) then
		set tabURLs to (URLs of tabs)
		set tabTitles to (titles of tabs)
		try
			-- may fail if the targeted tab is, for instance, empty
			set savedURL to (item (userTab + 1) of tabURLs)
			set savedTitle to (item (userTab + 1) of tabTitles)
		end try
	else
		set myHeadline to ""
		set myHeadline to selectedHeadline
		if (isFake of myHeadline) is equal to false then
			set savedURL to URL of myHeadline
			set savedTitle to title of myHeadline
		end if
	end if
	
	tell application "DEVONthink Pro"
		set incomingGroup to create location pDestinationGroup
		set archive to create record with {name:savedTitle, type:html, URL:savedURL} in incomingGroup
		set data of archive to download web archive from savedURL
	end tell
end tell

Where’s the previous post about Vienna?

Will look into it in the next couple of days.

Greetings

This is great! Sometimes it’s good to get a clean start in NetNewsWire… but I don’t like closing tabs without knowing what I’m missing. This takes care of both needs by ensuring the data is archived for future reference.

I’m glad you like it. :smiley: