MACROS -KEY LINE INTERPRETER
The macro language is build above python and allows many functional possibilities.
The macros are accessible through the 'KEY' line.
Insert the name of the macro and arguments , then hit 'RETURN'.
Notes
1. Definition
- Macros for the line interpreter allow to automate repetitive tasks, possibly with parameters
- Macros allow to insert information in the NOTEPAD
The macro language is build above python and allows many functional possibilities.
1.1. USING THE MACROS
The macros are accessible through the 'KEY' line.
Insert the name of the macro and arguments , then hit 'RETURN'.
1.1.1. Some predefined macros, which may serve as example
Macro | Objective | Example | Result |
---|---|---|---|
LIST | show the list of available macros at any time | in the notepad | |
r |
shows the recent news about a topic, using google
time possibilities are :
in french or english |
infos since last week about notre-dame :
|
in the notepad :
in web browser |
!c xxx | opens file about xxx otherwise display possible options | you may modify this file to add more possibilities | opens some file |
1.1.2. WRITING MACROS
Notes
- the code of the macro xxx is the xxx.txt file in the directory KM2_USER/MACROS
- USAGE : !xxx arg1, arg2, ...
1.1.2. 1. PRINCIPLES OF THE MACRO LANGUAGE
Macros refer to a separate named file, and require elementary programming knowledge of python1.1.2. 2. Passing parameters
- from the command line
- from other macros
1.1.2. 3. Instructions
- all one-line python statements are executable
- One line = one instruction
1.1.2. 4. Special statements
The special statements are in the following table :NAME | syntax | note |
---|---|---|
IF | IF condition THEN s1; s2...; sn ELSE sn+1; ... |
in one line only
one STATEMENT can be RETURN xxx |
RETURN | RETURN string | |
PARSE | PARSE filename TO variable |
parses an xmind file into a SGH structure internally, and affects this parse to the variable |
AT | AT node name |
searches the current parsed workspace for a node whose title is |
HYPERLINK --> | HYPERLINK --> variable | once a node is found, allows to get the hyperlink |
TREE_STR --> | TREE_STR --> variable | once a node is found, converts the sub-tree into a string |
1.1.3. Examples of macros
Macro | Code |
---|---|
LIST |
|
r |
|
!c xxx |
...