-
I ask for a suggestion how to correct the following script that has to set the width of a selection of nodes, it generates a recurrence that I like to avoid: it is asking the same questions for all of the selected nodes, instead I need just one time question and after sizing the nodes (which command is wrong?) import org.freeplane.view.swing.map.NodeView Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
Comment: In fact in the dialog input command I do not know even the meaning of the NodeModel concept... |
Beta Was this translation helpful? Give feedback.
-
Hi Illegit/SFPC A great question. This is something that many scripters run into. The topic is related to how a script is executed by Freeplane, e.g. on a single node or on all selected nodes. Please see https://www.freeplane.org/wiki/index.php/Scripting#Execution_modes In your case, you want Freeplane to run the script only once, because your code takes care of going over all selected nodes and performing the width adjustments. Putting |
Beta Was this translation helpful? Give feedback.
-
For me the input dialog shows only once. I saved your code in a file How do you run it? |
Beta Was this translation helpful? Give feedback.
-
Hi macmarrum, I forgot to restart FP. it seems FP kept in memory previous settings. This is a little bit tricky because some changes in the script were accepted and this one was not... After restart everything si as expected. |
Beta Was this translation helpful? Give feedback.
-
Hi, Sometimes, for example when your script moves or reorders the selected nodes, For those cases you can create an empty list and add the selected nodes to it. Then the script will remeber which were the selected nodes at the beginning of the script and it won`t confuse itself. in short: to this: Edit:
use this instead: bye, edo |
Beta Was this translation helpful? Give feedback.
-
But Edo I got an "error type mismatch"...? |
Beta Was this translation helpful? Give feedback.
For me the input dialog shows only once.
I saved your code in a file
<freeplane-user-dir>/1.9.x/scripts/SFPC.groovy
, adding// @ExecutionModes({ON_SINGLE_NODE})
on top of the file → SFPC.groovy.zipI restarted my Freeplane.
I selected 4 nodes and ran the script (
Tools->Scripts->SFPC
)How do you run it?