Looking for a script to split the selected topics if a character (ex) is present

Mini M. shared this question 3 years ago
Answered

Assume you have a topic like this


Term ☛ detailed definition of the term


I would like to have a script that I can run that can traverse my mind maps an for any topic that has ☛ it should split it with the part following ☛ becoming a subtopic of the initial topic

So in the above case "Term" will be a topic and "detailed definition of the term" will be a subtopic of it


Is there such a script that I can use directly or leverage to get what I need ?

Best Answer
photo

This code does the job , no need to cut a tree to lit a fire


Sub Main

Dim t,st As Topic
Dim arrSplitStrings() As String
For Each t In ActiveDocument.Range(mmRangeAllTopics)
    If t.AllSubTopics.Count=0 Then
    	t.FillColor.SetARGB(100,255,255,0)
        t.Font.Size = 8'
        If t.IsSelected Then
        	If InStr(t.Text, "►") Then
	        	arrSplitStrings = Split(t.Text, "►")
				t.Font.Size = 10
				t.Font.Bold= 0
				t.Text=arrSplitStrings(0)
				t.AddSubTopic(arrSplitStrings(1))

				'For Each st In
				'st.Font.Size=20
			End If

        End If





    End If
Next

End Sub

Replies (3)

photo
1

There is a facility in the MAP add-in for MindManager which does just this: https://www.olympic-limited.co.uk/map-4-0-out-now/

There are two options - split a topic into topics at the same level using the carat ^ symbol, or split the subsequent text into sub-topics using the tilde ~ symbol.

However, I'm having some glitches with this feature at the moment which I've reported to the company producing MAP. This just may be a glitch with my installation so I suggest you download the trial and see if it works for you.

photo
1

This code does the job , no need to cut a tree to lit a fire


Sub Main

Dim t,st As Topic
Dim arrSplitStrings() As String
For Each t In ActiveDocument.Range(mmRangeAllTopics)
    If t.AllSubTopics.Count=0 Then
    	t.FillColor.SetARGB(100,255,255,0)
        t.Font.Size = 8'
        If t.IsSelected Then
        	If InStr(t.Text, "►") Then
	        	arrSplitStrings = Split(t.Text, "►")
				t.Font.Size = 10
				t.Font.Bold= 0
				t.Text=arrSplitStrings(0)
				t.AddSubTopic(arrSplitStrings(1))

				'For Each st In
				'st.Font.Size=20
			End If

        End If





    End If
Next

End Sub

photo
1

PS: you can't store ► in a script you need to use strMarker=ChrW(9658) for that and then use strMarker where it says "►Ț

---