MindManager 2017 Macro - Loop Through Markers

  • 1
  • Question
  • Updated 3 years ago

I'm trying to find out how to loop through the markers I've created an assigned to a task, but I can't seem to get the code right. Do you need to know the name of the marker? I've been trying to use the GetAttributes function, but I have a feeling I might not be on the right path.

Does anyone have some sample code for this?
Photo of Andrew Coutts

Andrew Coutts

  • 5 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Nick Duffill

Nick Duffill, Champion

  • 608 Posts
  • 253 Reply Likes
Hello Andrew

CustomAttributes are private data stored on the topic and are not related to markers.

Tag markers are called TextLabels inside the API, which can be confusing. Tags and Icons are in separate collections, and within the Icons collection, stock and custom icon types are mixed.
Here is some macro code:
Sub Main
    Dim m_Icon As Icon
    For Each m_Icon In ActiveDocument.Selection.PrimaryTopic.Icons
        Debug.Print m_Icon.Name
    Dim m_Tag As TextLabel
    For Each m_Tag In ActiveDocument.Selection.PrimaryTopic.TextLabels
        Debug.Print m_Tag.Name
End Sub
Markers on a topic are not expressed in terms of cross references to the marker groups. This is because you can paste a fragment containing markers from another map altogether, which may have a different set of markers. If you need to correlate the marker on a topic to the item in the marker group, you generally have to iterate the map marker groups to find it.
Photo of Andrew Coutts

Andrew Coutts

  • 5 Posts
  • 0 Reply Likes
Hey Nick, thank you so much for your swift response. This has made things a lot clearer on my end.

When I try to look up the MarkerGroup from the ID, how do I set the MapMarkerGroup?

    Dim mGroup As MapMarkerGroup