Writing Macros

Contents


Overview

One simple way to write macros is to look at an already existing macros or at the Command History and write a new macro in a similar fassion. Here are some rules one should follow when writing macros:

- Know the difference between Server and Client commands
- All Client commands begin with "@"; for example: "@Exit"
- All commands are case insensitive (except when specifying the file name and a path to a file)
- Blank lines are allowed in the macros for easy readability
- Comment lines start with "#" ('pound sign') and continue until the end of the line

Server macro commands


Client macro commands 


Path Specification

There are two ways to specify the location of the file: (1) absolute, or (2) relative. The absolute path specifies the full path of the file. The relative path specifies the path relative to the current working directory. An example of the absolute path is:

/home/user/saves/myFile.txt

An example of a relative path is:

../macros/newMacroFile.txt

If the working directory was set to: "/home/user/saves/", then specifying "../macros/newMacroFile.txt" saves the file "newMacroFile.txt" in the following directory: "/home/user/macros/". ".." imply that one has to go one directory up from the working directory. If the path was "../../user2/", then one will go up 2 directories.

Here is another example of a relative path:

help/newHelpFile.txt

If the working directory was set to: "/home/user/saves/", then specifying "help/newHelpFile.txt" saves the file "newHelpFile.txt" in the following directory: "/home/user/saves/help/". Since the path does not have a file seperator ("/" or "\" depending on the operating system) at the beginning, the path must be relative to the working directory.