Rss to intray.mmbas

Rem rss_feed_to_intray 11Mar07 http://www.activityowner.com http://creativecommons.org/licenses/by-sa/2.5/ Rem Rem Start with a new Map Rem Add a rss-feed as a main topic Rem Refresh map part by pressing shift F5 Rem run macro Rem It will add intray, tracks old rssmessge in rssdb, puts new in intray Sub Main rfound=False ifound=False Set doc=ActiveDocument Set MainTopics=doc.CentralTopic.AllSubTopics doc.Selection.RemoveAll 'First make sure we have rss,rssdb,and in-tray branches For Each m In Maintopics If InStr(LCase(m.Task.Categories),"in-tray") Then ifound=True Set intray=m End If	 	If InStr(LCase(m.Text),"rssdb") Then Set rssdb=m rfound=True End If	Next If Not rfound Then Set rssdb = doc.CentralTopic.AddSubTopic("rssdb") If Not ifound Then Set intray = doc.CentralTopic.AddSubTopic("In-Tray") If Not ifound Then intray.Task.Categories="In-tray*,process" For Each m In Maintopics If m.HasHyperlink Then 'assume hyperlinked main topics are rss feeds For Each rssmessage In m.AllSubTopics i=rssdb.AllSubTopics.Count newmail=True While i>0 And newmail If rssmessage.Text=rssdb.AllSubTopics(i).Text Then newmail=False i=i-1 Wend If newmail And InStr(LCase(rssmessage.Text),"daily jott update")=0 Then rssdb.AddSubTopic(rssmessage.Text) intray.AddSubTopic(rssmessage.Text) Set t=intray.AllSubTopics(intray.AllSubTopics.Count) If rssmessage.Hyperlink.IsValid Then t.CreateHyperlink(rssmessage.Hyperlink.Address) t.Notes.Text=rssmessage.Notes.Text t.Task.Complete=0 doc.Selection.Add(t) End If     		Next End If   Next rssdb.SetLevelOfDetail(0) End Sub