Chibimagic's Weblog

Posts Tagged ‘code applescript netnewswire

I subscribe to tweets in NetNewsWire, and I’ve been annoyed that there’s no quick and simple way to load URLs that people post. You have to grab the mouse, highlight the text, copy, tab to Safari, then paste and hit enter. I wrote this so that I wouldn’t have to take my hands off the mouse.

set URLtoopen to ""
tell application "NetNewsWire"
	set feedName to display name of selectedSubscription
	if feedName is "Twitter" then
		set headlineContents to title of selectedHeadline
		set oldtid to AppleScript's text item delimiters
		set AppleScript's text item delimiters to space
		repeat with titleword in text items of headlineContents
				if word 1 of titleword is "http" then
					set URLtoopen to titleword as string
					exit repeat
				end if
			end try
		end repeat
		set AppleScript's text item delimiters to oldtid
	end if
end tell
if URLtoopen is not "" then
	tell application "Safari" to open location URLtoopen
end if

I saved a copy of it in NetNewsWire’s scripts folder, and set up a keyboard shortcut of Command-Right Arrow in the Keyboard & Mouse pane of System Preferences. Now I can quickly load URLs that everyone posts. This only grabs the first URL in the post, since I’ve never seen more than one per post, and I don’t think there’s room for more than one anyway.

The code gets cut off by the theme I’m using, but copy paste should work if you want to use it.

  • None
  • Marketing Consultant: You're an great writer. You have brought up some really interesting insights. Just wanted to say fantastic blogs! I know tons of people see your write
  • optical franchise opportunities: Right now it looks like Wordpress is the preferred blogging platform out there right now. (from what I've read) Is that what you are using on your blo
  • startup speaker: Interesting content. A magnificent article. It is very informative and you are obviously very knowledgeable in this area.