TreeDyn Manual
TreeDyn Scripting Examples

Abstract

Scripting enables the use of a simple language dedicated to tree graphical management. This language is based on a list of commands with one or more argument(s), and can be used either interactively at the Scripting panel prompt and/or listed and saved in a script file (text format, TreeDyn scripts use the .tds suffix). Scripts files can be loaded with the "Open script..." option of the "File" menu (Main panel or Scripting panel). A TreeDyn script is a useful way to save graphicals treatments of trees and for the automation of repetitive tasks. Scripting may use TreeDyn annotations files. A given script can be applied to several trees, and several scripts may be used on a given tree.

Table of contents
Table of contents:

  1. Example #1
  2. Example #2
  3. Example #3
  4. Example #4

Conventions:
  • M1 = Left Mouse Button
  • M3 = Right Mouse Button
  • CM = Contextual Menu with M3

Sample#1

Fetch the 2 followings files and start a TreeDyn session. First load the tree (1), then load the script (2)
The script (with comments) | The tree before the script | The tree after the script

Sample#2: scripting with annotations

Fetch the 3 followings files and start a TreeDyn session. Then first load the tree (1), then the annotations (2) and finally the script (3).

This script use an annotations file listing binary variables. This information is used for building a graphical matrix in regard of leaves

The script (with comments) | The tree before the script | The tree after the script

Sample#3: scripting with annotations

Fetch the 3 followings files and start a TreeDyn session. Then first load the tree (1), then the annotations (2) and finally the script (3).

This script replace leaves names by data organised in a given format

The script (with comments) | The tree before the script | The tree after the script

Sample#4: scripting with annotations

Fetch the 3 followings files and start a TreeDyn session. Then first load the tree (1), then the annotations (2) and finally the script (3).

This script works on the "Key3" variable from the "sample04" annotations file. It adds several symbols in regards of leaves. One symbol for a given value of the "Key3" variable and one column for a given symbol. All the symbols use the same color (black).

The script (with comments) | The tree before the script | The tree after the script