Ao-minimapcentral

From ActivityOwnerWiki
Jump to: navigation, search
'ao_minimapcentral 'Copyright: http://creativecommons.org/licenses/by-nc-nd/3.0/
'Information: http://wiki.activityowner.com
'02Jan2011
Option Explicit
'#uses "ao_common.mmbas"
Sub Main
	Dim n As Document
	Dim a As Document
	Dim t As Topic
	Dim s As Topic
	Dim b As Topic
	Dim count As Integer
	Dim found As Boolean
	Debug.Clear
	count=0
	Set a=ActiveDocument
	Set n = getmap(GetPath(mmDirectoryMyMaps) & "\TempMapCentral.mmap")
	n.Activate
	For Each t In n.CentralTopic.AllSubTopics
		t.Delete
	Next
	n.CentralTopic.Text="Scanning for active maps"
	For Each t In a.Range(mmRangeAllTopics)
		found=False

		If t.HasHyperlink Then
			If InStr(LCase(t.Text),"in-tray")=0 Then
				t.Hyperlink.Absolute=True
				For Each s In n.CentralTopic.AllSubTopics
					If t.Hyperlink.Address =s.Hyperlink.Address Then
						found=True
						Exit For
					End If
				Next
				If Not found Then
					Set b = n.CentralTopic.AddSubTopic(t.Text)
					Debug.Print t.Hyperlink.Address
					b.CreateHyperlink(t.Hyperlink.Address)
					b.Notes.Text=t.Hyperlink.Address
					count=count+1
				End If
			End If
		End If
	Next
	n.CentralTopic.Text=Str(count) & " maps with active tasks"
	n.Save
End Sub