[VBA] is there existing tools to compare 2 mindmaps like beyond compare? if no, i want to have one.
Discussion Open
in my mind, it will open 2 mindmaps, show the same, differ, Lt and Rt orphans, and i could edit as usual.
macros could be used to show them by colors or tags etc.
thanks
afair, i started using mindmanager since something like 2003 2004, using mindmanager X5?
i am no newbie in USING it.
i am just new to the macros because i am not familiar with VBA.
afair, i started using mindmanager since something like 2003 2004, using mindmanager X5?
i am no newbie in USING it.
i am just new to the macros because i am not familiar with VBA.
suppose i got map A, B, C
A is from book A
B is from book B
C is a merge of both.
and A, B may change depends on my reading of book A and B
i guess i'll make a macro, that can add custom tags to the selected topics in current map, tell whether the selected topics is found in another map.
as above, suppose I got A1 (read 1st time), B1, C1
i can easily copy A1 into C1.
may be also easily copy B1 into C1 manually.
then i read books again, making A2, B2.
now i'll set CurrentMap as A2, CurrentTargetMap as C1,
select some topics in A2, see if they are present in CurrentTargetMap, if not, will customly lable "not in CurrentTargetMap".
then i knew that what are new nodes in A2. and copy them to C1 manually. (which now becomes C2).
repeat for B2 etc.
the tag could be easily removed from the RHS toolbar all together.
ps: this is more like for merging digestions from 2 books, which is what i mostly use mm for.
it's not that like beyond compare however.
suppose i got map A, B, C
A is from book A
B is from book B
C is a merge of both.
and A, B may change depends on my reading of book A and B
i guess i'll make a macro, that can add custom tags to the selected topics in current map, tell whether the selected topics is found in another map.
as above, suppose I got A1 (read 1st time), B1, C1
i can easily copy A1 into C1.
may be also easily copy B1 into C1 manually.
then i read books again, making A2, B2.
now i'll set CurrentMap as A2, CurrentTargetMap as C1,
select some topics in A2, see if they are present in CurrentTargetMap, if not, will customly lable "not in CurrentTargetMap".
then i knew that what are new nodes in A2. and copy them to C1 manually. (which now becomes C2).
repeat for B2 etc.
the tag could be easily removed from the RHS toolbar all together.
ps: this is more like for merging digestions from 2 books, which is what i mostly use mm for.
it's not that like beyond compare however.
crazy, gpt4 wrote up the backbone for me.
i guess i only need to modify it later.
crazy, gpt4 wrote up the backbone for me.
i guess i only need to modify it later.
Certainly! I've updated the macro to tag topics not found in the CurrentTargetMap with "not found in CurrentTargetMap". Here's the updated WinWrap Basic macro:
```vb
Sub FindAndTagTopics()
Dim CurrentMap As Document
Dim CurrentTargetMap As Document
Dim SelectedTopics As Topics
Dim TargetMapTopics As Topics
Dim topic As Topic
Dim targetTopic As Topic
Dim found As Boolean
Dim targetMapPath As String
' Set the current map
Set CurrentMap = Application.ActiveDocument
' Use the Open File Dialog to choose the target map
targetMapPath = Application.OpenFileDialog("Select the CurrentTargetMap", "MindManager Files (*.mmap)|*.mmap|All Files (*.*)|*.*", "", "", False)
' Check if a file was selected
If Len(targetMapPath) = 0 Then
MsgBox "No file selected. Exiting macro."
Exit Sub
End If
' Open the target map
Set CurrentTargetMap = Application.Documents.Open(targetMapPath)
' Get the selected topics in the current map
Set SelectedTopics = CurrentMap.Selection
' Get all topics in the target map
Set TargetMapTopics = CurrentTargetMap.AllTopics
' Iterate through the selected topics in the current map
For Each topic In SelectedTopics
found = False
' Check if the topic exists in the target map
For Each targetTopic In TargetMapTopics
If topic.Text = targetTopic.Text Then
found = True
Exit For
End If
Next targetTopic
' If found, add the tag "found in CurrentTargetMap", otherwise add "not found in CurrentTargetMap"
If found Then
topic.Tags.Add "found in CurrentTargetMap"
Else
topic.Tags.Add "not found in CurrentTargetMap"
End If
Next topic
' Close the target map without saving
CurrentTargetMap.Close False
End Sub
```
Now, when you run this macro, it will tag the selected topics in the CurrentMap with "found in CurrentTargetMap" if they are present in the CurrentTargetMap, and with "not found in CurrentTargetMap" if they are not present.
it's almost there, but it didn't 100% fit into the winwrap and the mm object model.
i did have to spend some time later to make it work.
Certainly! I've updated the macro to tag topics not found in the CurrentTargetMap with "not found in CurrentTargetMap". Here's the updated WinWrap Basic macro:
```vb
Sub FindAndTagTopics()
Dim CurrentMap As Document
Dim CurrentTargetMap As Document
Dim SelectedTopics As Topics
Dim TargetMapTopics As Topics
Dim topic As Topic
Dim targetTopic As Topic
Dim found As Boolean
Dim targetMapPath As String
' Set the current map
Set CurrentMap = Application.ActiveDocument
' Use the Open File Dialog to choose the target map
targetMapPath = Application.OpenFileDialog("Select the CurrentTargetMap", "MindManager Files (*.mmap)|*.mmap|All Files (*.*)|*.*", "", "", False)
' Check if a file was selected
If Len(targetMapPath) = 0 Then
MsgBox "No file selected. Exiting macro."
Exit Sub
End If
' Open the target map
Set CurrentTargetMap = Application.Documents.Open(targetMapPath)
' Get the selected topics in the current map
Set SelectedTopics = CurrentMap.Selection
' Get all topics in the target map
Set TargetMapTopics = CurrentTargetMap.AllTopics
' Iterate through the selected topics in the current map
For Each topic In SelectedTopics
found = False
' Check if the topic exists in the target map
For Each targetTopic In TargetMapTopics
If topic.Text = targetTopic.Text Then
found = True
Exit For
End If
Next targetTopic
' If found, add the tag "found in CurrentTargetMap", otherwise add "not found in CurrentTargetMap"
If found Then
topic.Tags.Add "found in CurrentTargetMap"
Else
topic.Tags.Add "not found in CurrentTargetMap"
End If
Next topic
' Close the target map without saving
CurrentTargetMap.Close False
End Sub
```
Now, when you run this macro, it will tag the selected topics in the CurrentMap with "found in CurrentTargetMap" if they are present in the CurrentTargetMap, and with "not found in CurrentTargetMap" if they are not present.
it's almost there, but it didn't 100% fit into the winwrap and the mm object model.
i did have to spend some time later to make it work.
it's reasonable, it just take 1 selected topic from CurrentMap, then test against all topics in CurrentTargetMap.
and then repeat for all other selected topics in CurrentMap.
this macro should have existed long time before.
it's reasonable, it just take 1 selected topic from CurrentMap, then test against all topics in CurrentTargetMap.
and then repeat for all other selected topics in CurrentMap.
this macro should have existed long time before.
it's not too smart, i didn't see OpenFileDialog in v20 api, i only see FileDialog.
either i have to ask gpt4 again or i have to troubleshoot myself.
it's not too smart, i didn't see OpenFileDialog in v20 api, i only see FileDialog.
either i have to ask gpt4 again or i have to troubleshoot myself.
the gpt4 not very update, it seems to open a file dialog, one needs to use GetFileDialog now.
here is the one i have to manually modify:
need troubleshoot to make it work.
the gpt4 not very update, it seems to open a file dialog, one needs to use GetFileDialog now.
here is the one i have to manually modify:
need troubleshoot to make it work.
i am almost there!
1. the methods to deal /w "tag" is not well documented in the API
2. now is selected topic vs a whole map (which is my idea at the first time),
may be it will be better if it is selected topics in map 1 vs selected topics in map2, and add tags to the selected topics in map1.
the macro will become large and more difficult.
i am almost there!
1. the methods to deal /w "tag" is not well documented in the API
2. now is selected topic vs a whole map (which is my idea at the first time),
may be it will be better if it is selected topics in map 1 vs selected topics in map2, and add tags to the selected topics in map1.
the macro will become large and more difficult.
the "repeated" in the CurrentMap is added itself by the macro!
the "repeated" in the CurrentMap is added itself by the macro!
I am like flying to the sky!
I am like flying to the sky!
crazy, the macros is done within an afternoon!
gpt4 helped much
crazy, the macros is done within an afternoon!
gpt4 helped much
compared to this target, which is untouched.
yes, this is more like a merger.
compared to this target, which is untouched.
yes, this is more like a merger.
done.
for CurrentMap's alphabet tree,
if i selected the alphabet tree in CurrentTargetMap, it will say found.
if i selected the digit tree in CurrentTargetMap, it will say not found
but just think that i should compare also the notes's text too.
done.
for CurrentMap's alphabet tree,
if i selected the alphabet tree in CurrentTargetMap, it will say found.
if i selected the digit tree in CurrentTargetMap, it will say not found
but just think that i should compare also the notes's text too.
oh my god,
gpt4 helped me to add half a sentence, it now compare the text in the note too!
oh my god,
gpt4 helped me to add half a sentence, it now compare the text in the note too!
---