Difference between revisions of "External script file execution"
From Freeplane - free mind mapping and knowledge management software
(Created page with 'There is a mechanism to load and execute scripts from "script directories" matching a given name scheme (hardcoded: ".*\.groovy"). * The list of "script directories" is config...') |
(no need to add resources dynamically, formatting) |
||
Line 1: | Line 1: | ||
− | There is a mechanism to load and execute scripts from | + | There is a mechanism to load and execute scripts from ''script directories'' matching a given name scheme (hardcoded: <tt>".*\.groovy"</tt>). |
− | * The list of | + | |
− | * Matching scripts are listed in the | + | *The list of ''script directories'' is configurable in the config file (default: <tt>scripts</tt>, i.e. directory <tt>scripts</tt> in the freeplane user home). |
+ | *Matching scripts are listed in the ''Extra'' menu in a submenu ''Scripts''. | ||
+ | *Due to the flexible standard hotkey assignment it's possible to create hotkeys for these scripts. | ||
+ | |||
+ | For each script there are two menu entries, e.g. for a script <tt>testscript.groovy</tt>: | ||
+ | |||
+ | *''Execute Testscript'': This will invoke the script on every selected node, i.e. if three nodes are selected, it will be executed three times, once for each node with the ''node'' variable set to the respective node. | ||
+ | *''Execute Testscript recursively'': This will invoke the script on every selected node and recursively on all of its children. | ||
+ | **''Note:'' If a node and a child node are both selected, then the script is invoked on the child node twice. | ||
+ | *To execute a script on all nodes in a map one has to select the root node and execute the script recursively. | ||
+ | *The menu entries are formed by evaluating the following language resources with (pseudo code) <tt>(scriptname without suffix).firstToUpper()</tt> as <tt>{0}</tt>: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
ExecuteScript.text=Execute {0} | ExecuteScript.text=Execute {0} | ||
ExecuteScriptRecursively.text=Execute {0} recursively | ExecuteScriptRecursively.text=Execute {0} recursively | ||
− | |||
− | |||
− | [[Category:Advanced_Users]][[Category:Developer_Documentation]] | + | *Errors while loading or while execution of scripts are handled by error message popups. (See resources <tt>ExecuteScriptError.text</tt> and <tt>ReadScriptError.text</tt>.) |
+ | |||
+ | [[Category:Advanced_Users]] [[Category:Developer_Documentation]] |
Revision as of 10:30, 4 January 2010
There is a mechanism to load and execute scripts from script directories matching a given name scheme (hardcoded: ".*\.groovy").
- The list of script directories is configurable in the config file (default: scripts, i.e. directory scripts in the freeplane user home).
- Matching scripts are listed in the Extra menu in a submenu Scripts.
- Due to the flexible standard hotkey assignment it's possible to create hotkeys for these scripts.
For each script there are two menu entries, e.g. for a script testscript.groovy:
- Execute Testscript: This will invoke the script on every selected node, i.e. if three nodes are selected, it will be executed three times, once for each node with the node variable set to the respective node.
- Execute Testscript recursively: This will invoke the script on every selected node and recursively on all of its children.
- Note: If a node and a child node are both selected, then the script is invoked on the child node twice.
- To execute a script on all nodes in a map one has to select the root node and execute the script recursively.
- The menu entries are formed by evaluating the following language resources with (pseudo code) (scriptname without suffix).firstToUpper() as {0}:
ExecuteScript.text=Execute {0} ExecuteScriptRecursively.text=Execute {0} recursively
- Errors while loading or while execution of scripts are handled by error message popups. (See resources ExecuteScriptError.text and ReadScriptError.text.)