Log
An Applescript to add a NetNewsWire Tab to del.ico.us
Here’s an applescript that will take the URL and title from the currently selected tab in NetNewsWire and open a new tab to add a new link to your del.icio.us account.
tell application "NetNewsWire"
set i to index of selected tab + 1
set allurls to URLs of tabs
set myurl to item i of allurls
set alltitles to titles of tabs
set temptitle to item i of alltitles
end tell
set mytitle to encode_text(temptitle, true, true)
tell application "NetNewsWire"
set toopen to "http://del.icio.us/<YOUR_USERNAME>?noui=yes&jump=close&url=" & myurl & "&title=" & mytitle
open URL in new tab with toopen
end tell
on encode_text(this_text, encode_URL_A, encode_URL_B)
set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
set the URL_A_chars to "$+!'/?;&@=#%><{}[]\"~`^\\|*"
set the URL_B_chars to ".-_:<>"
set the acceptable_characters to the standard_characters
if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
set the encoded_text to ""
repeat with this_char in this_text
if this_char is in the acceptable_characters then
set the encoded_text to (the encoded_text & this_char)
else
set the encoded_text to (the encoded_text & encode_char(this_char)) as string
end if
end repeat
return the encoded_text
end encode_text
on encode_char(this_char)
set the ASCII_num to (the ASCII number this_char)
set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
set x to item ((ASCII_num div 16) + 1) of the hex_list
set y to item ((ASCII_num mod 16) + 1) of the hex_list
return ("%" & x & y) as string
end encode_char
I pulled the encode_text function from Studio Log. Apparently, it’s from apple, so it seems like fair game.
01/04/05 04:18PM Macintosh
Comments
Carla, what gets highlighted when you click “OK” in Script Editor?
09/24/06 7:16PM
Add a Comment
Have something to say about what I wrote here? Let’s hear it!
- Your name and email address are required, but your email will not be displayed on the site
- If you provide a URL, a link to your site will appear
- You may use the following HTML:
<strong>bold</strong><em>italic</em><a href="http://url">links</a>
- Double line breaks will be converted to paragraphs.
- As you type, you should get a nice little preview of your comment directly below the text box.
- I reserve the right to edit any comment for any reason (I’ll be reasonable).
Recently Played on iTunes
-
“Heroin”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:26 -
“All Tomorrow's Parties”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:20 -
“Run Run Run”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:16
Carla Hufstedler:
Thank you for this!
I’m having problems compiling it, though. I filled in my del.icio.us account name, identified the location of NNW when prompted…and received the error “Expected end of line but found property”. Any clues?
Thanks! :)
09/24/06 2:24PM