Conceptual view of a macro script

A Host On-Demand macro script consists of a single <HAScript> element that can contain up to three major types of subelements:
  • One <import> element (optional)
  • One <vars> element (optional)
  • One or more <screen> elements
Figure 1 shows a conceptual view of a sample macro script.
Figure 1. Conceptual view of a macro script
Conceptual view of a macro script

Figure 1 displays a <HAScript> element that contains instances of the major types of subelements: an <import> element (Import), a <vars> element (Variables), and three <screen> elements (Screen1, Screen2, and Screen3).

All macro scripts are structured like this, except that most have more screens. If there were 50 screens in the above macro, then Figure 1 would look much the same, except that after Screen3 there would be additional screens: Screen4, Screen5, and so on, up to Screen50. However, the order in which the screens are stored does not necessarily represent the order in which the screens are executed when the macro is played. See How the macro runtime processes a macro screen.

The <HAScript> element is the master element of a macro script. (HAScript stands for Host Access Script.) It encloses the entire macro and also contains, in its begin tag, attributes that contain information applicable to the entire macro, such as the macro's name. For an example of an <HAScript> element, see Figure 1.

The <import> element is used to import Java™ classes and is optional. Importing Java classes is an advanced topic that is discussed in Variables and imported Java classes.

The <vars> element is used to declare and initialize variables belonging to one of the standard data types (boolean, integer, double, string, or field). Using standard variables is an advanced topic that is discussed in Variables and imported Java classes.

The <screen> element is used to define a macro screen. The <screen> element is the most important element that occurs inside the <HAScript> element. As you can see in Figure 1, a macro script is composed mostly of <screen> elements (such as Screen1, Screen2, and Screen3 in the figure). Also, most of the other kinds of XML elements in a macro script occur somewhere inside a <screen> element.