Setting Adium status from a microsummary

cover image for Setting Adium status from a microsummary

Firefox 2 provides an useful feature called Microsummaries. Microsummaries enable users' bookmark labels to get automatically updated based on data on the site. This site provides my Plazes location and latest Twitter message as a microsummary:

Before this I've been using a script to populate my Plazes location to the Adium instant messaging status, but now I though the combination of position and status would be better here too. So I whipped up this quick AppleScript:

-- Bergie's blog summary updater
-- It reads the microsummary of a web page via Lynx and
-- then sets it as the Adium status line
-- Set the URL of your Microsummary page here
set summaryUrl to ""
set microSummary to do shell script "/opt/local/bin/lynx -width 500  -dump " & summaryUrl & "|iconv -f ISO-8859-1 -t UTF-8"
set locationSummary to findAndReplace("Henri Bergius, in ", "", microSummary)
tell application "Adium"
set my status message to locationSummary
end tell
on findAndReplace(tofind, toreplace, TheString)
set ditd to text item delimiters
set res to missing value
set text item delimiters to tofind
repeat with tis in text items of TheString
if res is missing value then
set res to tis
set res to res & toreplace & tis
end if
end repeat
set text item delimiters to ditd
return res
end findAndReplace

I set this to be run when I connect, and here are the results: