Today I've created a new bot function which shows latest 20 blog posts tagged with "Lotusphere2007" on Technorati. Took me 20 minutes to modify it from an old example of LotusScript agent and setup STWidget, the LotusScript agent code can be improved but it works.
It works like this: you type "Lotusphere2007" (not case sensitive) to sametime bot and it responds with the 20 latest blog posts. You can click the links in the result to read the post.
Here you can try the "Lotusphere2007" bot live: http://www.botstation.com/sametime/stwidget_lotusphere.html
Or just try it embedded at the end of this post with help of Sametime Widget.
Code of the LotusScript agent which bot calls to get the results:
Function AgentMain(doc As notesdocument)
Dim param As String
param= doc.ArgValue(0)
Dim objHttp, i
Set objHttp = CreateObject("Microsoft.XMLHTTP")
url = |http://feeds.technorati.com/feed/posts/tag/lotusphere2007|
objHttp.open "GET", url, False, "", ""
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.send("") 'send request to web server
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.loadXML (objHttp.ResponseText)
Set xmlLst = xmlDoc.getElementsByTagName("item")
cnt=0
For i = 0 To xmlLst.length - 1
cnt=cnt+1
Set xmlNode = xmlLst.Item(i)
Set att=xmlnode.childnodes
Forall child In att
If child.nodename="title" Then
tmp=tmp+Cstr(i)+". "+child.text+": "
End If
If child.nodename="link" Then
tmp=tmp+|<a href="|+child.text+|" target="_blank">Link</a><br/><br/>|
End If
If cnt=20 Then i=xmlLst.length
End Forall
Next
AgentMain="Last 20 posts in category Lotusphere2007:"+"<br/>"+tmp
End Function
Tags: Lotusphere2007 sametime sametime bot
Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts
Wednesday, January 24, 2007
Subscribe to:
Posts (Atom)
