Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 700

Warning: Invalid argument supplied for foreach() in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 701

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 705

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722

Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/project-web/freemind/htdocs/wiki/includes/MagicWord.php on line 722
Scripting - FreeMind

Scripting

From FreeMind

Jump to: navigation, search
(Examples: use gerunds for actions)
(API)
 
Line 1: Line 1:
-
FreeMind 0.9.0 beta series has a scripting facility using Groovy.
+
Since [[Release 0.9.0|FreeMind 0.9.0]] has a scripting facility using Groovy.
==Menu==
==Menu==
Line 9: Line 9:
==Using==
==Using==
-
New scripts can be created using the script editor, available from the menu Tools > Script Editor. Alternatively, you can plainly create an attribute whose name starts with "script" such as "script2"; such an attribute is understood by FreeMind to be a script.
+
Each script is stored in a named attribute of a node, named for example as "script1" or "script2". One node can have several scripts attached. There is no way to store scripts in a script file for the whole application; scripts can only be stored in mind maps[verify].
 +
 
 +
To add a new script to a node, use the script editor, available from the menu Tools > Script Editor. Alternatively, you can plainly create an attribute whose name starts with "script" such as "script2"; such an attribute is understood by FreeMind to be a script.
To run all the scripts in a mind map, use the menu Tools > Evaluate or press Alt + F8.
To run all the scripts in a mind map, use the menu Tools > Evaluate or press Alt + F8.
Line 28: Line 30:
For another set of examples, see the FreeMind documentation available from the menu Help > Documentation, the section "New features in version 0.9.0" and the subsection "Scripting support".
For another set of examples, see the FreeMind documentation available from the menu Help > Documentation, the section "New features in version 0.9.0" and the subsection "Scripting support".
 +
 +
==Script editor==
 +
 +
FreeMind has a very simplistic script editor, available from menu Tools > Script Editor. The editor has no color highlighting of code, and no specific support for writing Groovy scripts: it is basically a plain text editor like Notepad.
 +
 +
The editor has three panes: left one, right one, and bottom one. The left pane shows a list of scripts attached to a node. The right pane shows the script selected in the left pane. The bottom pane shows the results of the execution of a script.
 +
 +
The actions available in the menu Action of the script editor are New Script, Run, Sign Script, Dismiss Changes and Exit, and Save and Exit.
 +
 +
The action Action > New Script adds a new script to the left pane, named as "script1", "script2", etc. The newly created script can be edited in the right pane once the name of the script is selected in the left pane.
 +
 +
The action Action > Run runs the script selected in the left pane, and shows the result of running the script in the bottom pane, including any error messages.
 +
 +
The action Action > Sign Script makes it possible to sign a script. [To be documented].
==API==
==API==
The scripts can access FreeMind's scripting API--application programming interface. Above all, the scripts would typically make use of the methods of [http://freemind.cvs.sourceforge.net/viewvc/freemind/freemind/freemind/modes/mindmapmode/MindMapController.java?view=log MindMapController]. The mind map controller is available to scripts as 'c'.
The scripts can access FreeMind's scripting API--application programming interface. Above all, the scripts would typically make use of the methods of [http://freemind.cvs.sourceforge.net/viewvc/freemind/freemind/freemind/modes/mindmapmode/MindMapController.java?view=log MindMapController]. The mind map controller is available to scripts as 'c'.
 +
 +
These are the variables made available to scripts and their types:
 +
 +
<code>
 +
def MindMapController c // the controller
 +
 +
def MindMapNode node // the node the script is run on
 +
 +
def HashMap cookies sScriptCookies // A hashmap of key-value pairs (WHAT IS THIS ANYWAY?)
 +
 +
</code>
 +
 +
It is suggested the programmer uses the Freemind sourced code and an IDE to explore the types and what methods are available.
==Security==
==Security==
Line 41: Line 70:
* Trust Signed Scripts
* Trust Signed Scripts
* Optional User Key Alias for Signing
* Optional User Key Alias for Signing
 +
 +
==Groovy==
 +
The scripting engine and language of FreeMind is Groovy. To find out about Groovy, you can check the following web resources:
 +
* [http://groovy.codehaus.org/ Groovy homepage]
 +
* [http://onjava.com/pub/a/onjava/2004/09/29/groovy.html Groovy, Java's New Scripting Language], 2004-09-29, onjava.com
 +
* [http://ask.slashdot.org/article.pl?sid=06/04/18/2223237 Your Thoughts on the Groovy Scripting Language?], 2006-04-17, Slashdot - a review and a discussion thread on pros and cons of Groovy
==Implementation==
==Implementation==
Line 53: Line 88:
</node>
</node>
</pre>
</pre>
 +
 +
Scripting is implemented as an external [[plugin]].
 +
 +
Package: [http://freemind.cvs.sourceforge.net/viewvc/freemind/freemind/plugins/script/?pathrev=fm_060405_integration freemind/plugins/script/]
==Limitations==
==Limitations==
-
* Failure unless file operations permitted: Almost all scripts fail unless file operations are permitted for scripting; repeated execution of scripts succeeds, though[http://sourceforge.net/tracker/index.php?func=detail&aid=2789907&group_id=7118&atid=107118]
+
* There is no way to store scripts in a script file for the whole application; scripts can only be stored in mind maps[verify].
==See also==
==See also==
-
* [[FreeMind 0.9.0: The New Features]]
+
* [[Scripting/Mind map documentation]]
* [[Example scripts]]
* [[Example scripts]]
 +
* [[FreeMind 0.9.0: The New Features]]
[[Category:Development]]
[[Category:Development]]

Latest revision as of 19:28, 22 June 2015

Personal tools