General Modularity Example Module Projects & Files Commands & Scripting
Windows Menus Charts Tables Buttons & tools
Trees and Taxa Characters & Models Documentation General Utilities
Commands Scripting Snapshots Macros Cloning windows
Also: User's guide to scripting language class MesquiteCommand interface Commandable
class CommandChecker class Snapshot class Puppeteer

Macros

(updated August 2005)

Mesquite scripts, if stored in files in the appropriate places in the mesquite directory, are accessible from menus while Mesquite is running. They are therefore generally available as macros.

Eventually, we imagine that such macros could appear throughout Mesquite's menus as if they were alternatives to modules and other commands. At the moment, however, they appear in only a few places in the menu:

Currently available macros can be seen in the Macros submenu of the File menu.

Composition of macro

A macro indicates to what it applies by a "telling" command at its start. For instance, a macro that is intended to command a Tree Window (and which therefore should appear when the Tree Window is in front), should begin either with the line:

      telling TreeWindowMaker;

or with the line

      telling BasicTreeWindowMaker;

The latter is a subclass of the former.

Example macro

Here is a simple macro that is available when the tree window is in front. It brings up a mirror tree window and traces two characters, one left and one right:

telling TreeWindowMaker;
getWindow;
tell It;
newWindowAssistant #MirrorTreeWindowMaker;
tell It;
getWindow;
tell It;
newAssistantLeft #TraceCharacterHistory;
tell It;
setHistorySource #RecAncestralStates;
tell It;
setMethod #ParsAncestralStates;
endTell;
setCharacter 1;
endTell;
newAssistantRight #TraceCharacterHistory;
tell It;
setHistorySource #RecAncestralStates;
tell It;
setMethod #ParsAncestralStates;
endTell;
setCharacter 2;
endTell;
showWindow;
endTell;
endTell;
endTell;

Because of the availability of varying querying commands (see the Scripting Commands page available from the Help menu while Mesquite is running), macros can query the user for information as they are being executed.

Placement of macro files

A macro file, to be found by Mesquite, must occur in a directory called "macros" somewhere within the mesquite directory. If the macros directory is within a folder named "lib" or "duties" or "docs" or "documentation", it won't be found. It may be within a folder for one of the installed packages.


© W. Maddison & D. Maddison 2001 -2005