Wednesday, January 24, 2007

Sametime bot shows latest Lotusphere2007 blogs

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:

2 comments:

Anonymous said...

Hello Andrei,

how are you going?
I would like to get a copy of the Sametime widget code.
Can you help please?

Anonymous said...

Do you like playing the game where you need to use requiem gold, when you do not have requiem lant, you must borrow requiem money from friends, or you can not go on this game without cheap requiem lant. If you get requiem online gold, you can continue this game.
Do you like playing the game where you need to use maple mesos, when you do not have
mesos, you must borrow
cheap mesos from friends, or you buy
maplestory mesos. If you get
maple story mesos, you can continue this game.