I’ve been watching my Technorati ranking over the past few weeks and I’m happy to say it’s been climbing. In other news, I’ve been wanting to learn Applescripting. So, I put the two things together this evening and came up with my first practical AppleScript.
The script does one thing. It queries Technorati for my ranking, and updates my Skype mood message with a little ditty about my ranking: Technosailor.com Technorati Ranking: 2426.
To pull this off, I dug out my Technorati API key and grabbed the satimage XML library for Applescript (very useful!) and set about to write this script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 set trati_apikey to "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
set myblog to "technosailor.com"
set trati_URL to "http://api.technorati.com/bloginfo"
set trati_xml to do shell script "curl -G -d url=" & myblog & " -d key=" & trati_apikey & " " & trati_URL
(* Uses the SatImage XML Parser from:
http://www.satimage.fr/software/en/downloads_osaxen_pop.html *)
set trati_xml to XMLOpen trati_xml
set the_root to XMLRoot trati_xml
set tapi to XMLChild the_root index 1
set doc to XMLChild tapi index 1
set weblog to XMLChild doc index 2
set rank to XMLChild weblog index 8
set rank to XMLGetText rank
tell application "Skype"
send command "SET PROFILE MOOD_TEXT Technosailor.com Technorati Rank: " & rank script name "skypetechnorati"
end tell
Now to set about doing more cool Applescripting. :)