I wanted to get into tagging, but found little in the way of tagging blog entries. So I created my own solution. Here’s an AppleScript for NetNewsWire that allows you to tag whatever is currently visible in your main window. This means you can tag a blog entry, or tag a browser tab… the script just does the right thing for you. I'm using tagging alot now, and have replaced an old linkblog with a root tag "rssnews".
Create a new AppleScript using the code below, then save it as a compiled script in your ~/Library/Application Support/NetNewsWire/Scripts folder. Basically, the code puts up two dialogs, then posts the data. The first dialog asks you for a description, and the second dialog asks you for a set of tags. Some notes:
- when you first run this script, it will ask you if you want to use Cocoalicious or delicious
- if you choose delicious, then it will also ask you for your account name
- posting via Cocoalicious is silent, meaning it doesn't come to the foreground to interrupt you
- posting directly to delicious will involve your default browser coming to the foreground
Here's the Applescript code:
property needToAsk : true
property useCocoalicious : false
property accountName : ""
if needToAsk then
set theResults to display dialog "How should I tag?" buttons ["delicious", "Cocoalicious"]
if button returned of theResults is "Cocoalicious" then
set useCocoalicious to true
else
set theResults to display dialog "what is your delicious account name?" default answer ""
if button returned of theResults is "OK" then
set accountName to text returned of theResults
end if
end if
set needToAsk to false
end if
set theResults to display dialog "Enter extended description for this item" default answer ""
if button returned of theResults is "OK" then
set myExtended to text returned of theResults
set theResults to display dialog "Enter tags for this item" default answer ""
if button returned of theResults is "OK" then
set myTags to text returned of theResults
tell application "NetNewsWire"
set myDescription to ""
set myURL to ""
set currentTab to index of selected tab
if currentTab is 0 then
set myDescription to (title of selectedHeadline) as Unicode text
set myURL to (permalink of selectedHeadline) as Unicode text
if myURL is "" then
set myURL to (URL of selectedHeadline) as Unicode text
end if
else
set urlsList to URLs of tabs
set titlesList to titles of tabs
set myDescription to (item (currentTab + 1) of titlesList) as Unicode text
set myURL to (item (currentTab + 1) of urlsList) as Unicode text
end if
end tell
if useCocoalicious then
tell application "Cocoalicious"
make new post with properties {description:myDescription, extended:myExtended, url:myURL, tag string:myTags}
end tell
else
set u to "url=" & myURL & "&title=" & myDescription & "&extended=" & myExtended & "&tags=" & myTags
tell application "System Events"
open location "http://del.icio.us/" & accountName & "?" & u
end tell
end if
end if
end if

Recent Comments