Michael Biele
2010-08-24
I have generated a fairly large map that models a business's products and services and associated details. I am beginning to experience delays when entering and editing node content. It would be very helpful to identify the current number of nodes in my map. The .mm files is 1,411 KB.
Any help/advice would be appreciated,
Mike
Zak Anderson
2010-08-31
I'm a FreeMind noob, but I got this script to work:
import javax.swing.JOptionPane; def process(thisNode, childPosition, count) { count++ def i = 0 if (thisNode.children) { thisNode.children.each { i++ count = process(it, i, count) } } return count } JOptionPane.showMessageDialog(null, "Found " + process(node, 0, 0) + " nodes", "Node Count", JOptionPane.INFORMATION_MESSAGE);
Create an attribute on the root node called 'script'. Then go to the tools menu, script editor and paste the code into the top right pane.
Save and Exit the Script Editor and hit Alt-F8 to run the script.
Michael Biele
2010-09-01
Zak
Thanks VERY much, I'll give this a try…
Mike
Michael Biele
2010-09-01
Zak,
I read through the documentation and there was no reference regarding how to create and node attribute. Unfortunately I am not a SW developer (I was one 20 years ago but everything has changed) so if you could please explain how to create a node attribute. Also, I went to the tools menu and there is no selections regarding "script editor". I am currently running Version: 0.8.1.
Kind regards,
Mike
Zak Anderson
2010-09-03
Sorry, I forgot that the 0.9.0 version is still a Release Candidate. I'm using 0.9.0 RC7.
If you get this version, you can use Alt+F9 to add an attribute to the currently selected node. The script editor will also be found in the tools menu in the RC7 version.
Zak
Michael Biele
2010-09-03
Zak,
Thanks very much for the follow-up. Unfortunately I will need to wait for v 0.9.0 to become available to the general user community in order to take advantage of your script.
Kind regards,
Mike
Michael Biele
2010-09-04
Zak,
Yesterday, I downloaded Freepane (v:1.1.2) and opened and successfully ran the model I built in FreeMind. This version of Freepane supports the ability to assign attributes to nodes, so I followed your instructions above. I selected the root node and pressed the right-mouse button and then selected 'Edit Attributes' . A small 2-pane window appeared under the root node. The left pane had a drop-down menu with one entry, 'script1', which I selected and now 'script1' appeared in the left pain, the right pane was blank/empty. I then went to the tools menu and selected 'Script Editor…'. The 3-pane Script Editor window appeared. 'script1' appeared in the top left pane which I selected/highlighted. I then pasted your script into the top right pane. I then pressed the 'Actions' label in the top-left corner of the Script Editor and selected 'Save and Exit'. In the small 2-pane node attribute window that is just below the root node, the left pane contains 'script1' and the right pane now displays 'import java…'. I then pressed Alt-F8 to run the script but no results appeared and it was not evident the script ran. I waited several minutes and then went to the tools menu and selected the option ' Executed selected node scripts' and again no results appeared.
I have Java v1.6.0_21 installed on my laptop…
Any ideas why your script does not execute?
Thanks in advance for your help/advice
Warm regards,
Mike
Michael Biele
2010-09-04
Zak,
I went back into my model, deleted and then re-created a root-node attribute. In the Script Editor I pasted your code into the top-right pane, re-formatted your script to match the format above, then, within the Script Editor, ran the script. It worked!!!
I then saved and exited the Script Editor. I then selected the 'tools' menu and then selected 'Execute selected node scripts'. The Node Count information window appeared with the text: Found 16437 nodes. Wow, my model is much larger than what I had estimated it to be - I thought is was 1000+ nodes.
This is GREAT - thanks so much for developing the script above.
Kind regards,
Mike
Daniel Polansky
2010-09-04
Hello Mike, as far as I know, Freeplane is no more stable than FreeMind 0.9.0. FreeMind 0.9.0 is in RC status, as it still contains some bugs of considerable importance, such as that it drops newlines in notes upon converting a mind map saved from FreeMind 0.8.1 to the file format of FreeMind 0.9.0. This bug only concerns notes and not nodes, and, in addition, the very same bug was in Freeplane last time I checked. Many users are already using FreeMind 0.9.0, so if you are a fresh user of FreeMind and have no notes in your mind maps or your notes contain no newlines, I can recommend you try FreeMind 0.9.0. For a list of bugs that prevent final release of FreeMind 0.9.0 (but the decision is ultimately up to Christian Foltin and not up to me), see the wiki page
http://freemind.sourceforge.net/wiki/index.php/Finishing_0.9.0#Outstanding_bugs.
What I would recommend is that you backup your mind maps saved in 0.8.1 to be on the safe side, and give FreeMind 0.9.0 a try. The bug with newlines in notes being dropped upon converting is this:
http://sourceforge.net/tracker/?func=detail&aid=3021953&group_id=7118&atid=107118.
-Dan
Zak Anderson
2010-09-09
Hey Mike, glad it worked for you!
Bernd
2010-11-19
I tested this Script in Version 0.9.0 RC10 and got the error "message: startup failed, Script1.groovy: 1: unexpected token: def @ line 1, column 87" Is there any Solution in RC10 to count nodes and is it possible to count also sub nodes?
Zak Anderson
2011-01-03
geobernd, appears to be something about the spacing/formatting when you copy and paste the code from here. It pastes into a single line. Break out the formatting like it displays on my code sample and it works again (tested and got the same error you reported in RC14, changed the formatting to include appropriate line breaks and it works again)