Vienna: copy selection to incoming

My rss reader is Vienna. When clipping articles, I prefer taking rich note via DTP service to archiving. In Safari, the service grabs a rich text note along with its url. Nice. However, I read most of rss articles in the built-in browser within Vienna. If I use DTP service in the built-in browser, DTP take a rich note, but without its url. There was a thread explaining a similar case in NetNewsWire at devon-technologies.com/phpBB … php?t=1573

First, I took a look at the applescript, Copy Selection to Incoming, which came with DTP package. Then, I checked out the applescript dictionary of Vienna. In Vienna, I couldn’t find any way to get the url of the current browser tab. So, I had to take an alternative approach to this matter. The way I read an article is that I select an article and double-click it. In other words, when I’m viewing an article, there is an article selected in article list pane. If you are like me, the following might help.

Basically, I’ve borrowed a part of the original applescript written by Christian and added a few lines. Change the value of pDestinationGroup to the group you prefer. Save the script to ~/Library/Scripts/Applications/Vienna.


property pDestinationGroup : "/incoming"

tell application "Vienna"
	activate
	set theVersion to version
	if theVersion is greater than or equal to "2.0.0.2007" then
		set theArticle to the current article
		if theArticle is not false then
			set theURL to the link of theArticle
			set theTitle to the title of theArticle
			tell application "System Events"
				keystroke "c" using {command down}
				delay 0.5
				tell application "DEVONthink Pro"
					set incomingGroup to create location pDestinationGroup
					set newRecord to paste clipboard to incomingGroup
					set URL of newRecord to theURL
					set name of newRecord to theTitle
				end tell
			end tell
		end if
	else
		display dialog "This script requires Vienna 2.0.0.2007 or later"
	end if
end tell

The script will not get a correct url, if the article of current tab and the selected article of article list is different. I just wish Vienna provided url of opened tab.

If you assign a shortcut key to this script, it will not work well. My guess is this has something to do with UI scripting. I use it thru a script menu. Any suggestion or improvement will be appreciated.

(FYI) In Vienna, there is a script command called ‘get selection’ which gets a selected text whether it’s in article viewer or built-in browser. I tried, but it only returned plain text, not rich text because I really wanted to avoid UI scripting.

Uh-uh :confused: The script seems to have a strange problem. Sometimes, it gets the clipboard right, sometimes not. Can someone shed some light on this?

I’ve noticed that Vienna only captures the link of the article that is selected in the “Folders” pane to the left. If you have another tab open on the right, it still only captures the link from the left pane. I’m sure there is a way to have it point to the window you want, but I’m not sure Vienna’s nomenclature is for these three panes. Sorry. Let me know if you figure that one out.

Gabe

Thanks for the word, Gabe.

Maybe it’s possible, but I surmise it’s not so easy. It’s not difficult in NetNewsWire because NNW provides a clean access to browser tabs in applescript. I’m not sure this has anything to do with the problem in which the clipboard sometimes gets old copy.

System event scripting is not always reliable, increasing the delay to 1 second and/or running it via the scripts menu extra might fix the problem.

Reliability got better. Thank you for the advice. I wish Apple implemented a better system event scripting. Oh, well, some days after the boot camp hype :unamused: