[VBA] is there existing tools to compare 2 mindmaps like beyond compare? if no, i want to have one.

charles c. shared this question 16 days ago
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

Replies (14)

photo
1

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.

photo
1

new version will prevent people USING it without paid. let's see is market share more important or any change in revenue is more important.

photo
photo
1

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.

photo
1

crazy, gpt4 wrote up the backbone for me.

i guess i only need to modify it later.

photo
1

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.

photo
1

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.

photo
1

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.

photo
1

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.

<pre>Sub Main
	Dim FileDialog As FileDialog
    Dim filePath As String

    ' Create a File Dialog to choose a file
    Set FileDialog = GetFileDialog(MmFileDialogType.mmFileDialogOpen)

    ' Set the file dialog properties
    With FileDialog
        .Title = "Select a file"
        '.Filter = "MindManager Files (*.mmap)|*.mmap|All Files (*.*)|*.*"
        .InitialFileName = ""
        .AllowMultiSelect = False

        ' Show the file dialog and store the selected file's path
        If .Show Then
            filePath = .SelectedItems(1)
        Else
            MsgBox "No file selected."
            Exit Sub
        End If
    End With

    ' Display a message box with the selected file's path
    MsgBox "Selected file: " & filePath
End Sub</pre>

photo
1

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.

photo
1

28a2cb1ab7e622db1dabb220cd7f9beb


the "repeated" in the CurrentMap is added itself by the macro!

34f1bf9010ad0ea872f54dd44f8d2c3c

photo
1

I am like flying to the sky!

photo
1

crazy, the macros is done within an afternoon!

1ce6b8251b7d241fb226f5df72e748c7


gpt4 helped much

photo
1

compared to this target, which is untouched.

2ce38cb08d99856c60ade2c7f63128f4


yes, this is more like a merger.

photo
1

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

4ae573dc69d916df5177c0fc3eb49f95

32494c9c9fd86879262158a1913ded14


but just think that i should compare also the notes's text too.

photo
1

oh my god,


gpt4 helped me to add half a sentence, it now compare the text in the note too!


8abe9302184efe67765615993223ad0a

Leave a Comment
 
Attach a file