MindManager Macro - add text to all topics

Vincenzo shared this question 3 hours ago
Discussion Open

Hello,

I am trying to create a macro in MindManager 25 (64-bit) using WinWrap Basic COM mode ('#Language "WWB-COM"). The goal is to add text (it is project ID) recursively to all topics starting from the Central Topic.

Here is the minimal code I am using:

'#Language "WWB-COM"

Sub Main()
    Dim appendText
    appendText = " - ADDED"
    
    AddTextRecursive ActiveMap.CentralTopic, appendText
End Sub

Sub AddTextRecursive(topic, appendText)
    Dim subT
    
    If InStr(topic.Text, appendText) = 0 Then
        topic.Text = topic.Text & appendText
    End If
    
    For Each subT In topic.SubTopics
        AddTextRecursive subT, appendText
    Next
End Sub
When I run this macro, I get the error:
“Expecting a valid data type (Eg. integer)”
…exactly at the line:

AddTextRecursive ActiveMap.CentralTopic, appendText
I have confirmed:

  • The macro engine is set to '#Language "WWB-COM"
  • I tried removing Set and Call
  • I also tried iterating directly with For Each t In ActiveMap.CentralTopic.SubTopics and get the same error

It seems that in MindManager 25 64-bit, passing ActiveMap.CentralTopic as a parameter to a Sub fails.

Questions:

  1. Is there a known limitation or bug in MindManager 25 COM scripting that prevents passing CentralTopic as a parameter?
  2. What is the correct way to recursively iterate all topics starting from the Central Topic using WinWrap Basic COM?
  3. Are there recommended workarounds to update all topic text via macro in MindManager 25 64-bit?

Thank you very much for your guidance!

Leave a Comment
 
Attach a file