The elements of a Window Declaration
describe a window, menu, or control that a Phantom script interacts
with. There are five elements that describe a window:
Type - Indicates
what kind of a declaration the information represents. Can be either
a Menu or a MainWin.
Tag - The text
or number tag of the declaration. This corresponds to the window title
text if it exists. If there is not title text, or the type is Menu,
it corresponds to an index (n) number indicating it is the 'nth' child
of type Class in the parent window. If a tag is a text tag (the name
of a window), it must be enclosed in quotes ("). If it is an index
number, it must not be in quotes. If a wildcard (*) is manually
set in a text Tag, the interpreter will find the window that contains
the text to the left of the wildcard. If the text of the window may
change or is unknown, this can be a useful option. Setting the entire
tag to "*" causes the interpreter to find the first window
or child window that matches the Class.
Class - Indicates
the class of the object. This is the same class that the operating system
recognizes. This item must be in quotes (") and supports the use
of wildcards. The Window Types section describes this in more detail.
Parent - Indicates
whether or not the object is a parent to another object. A value of
1 is set if it is a parent, 0 otherwise. This item should generally
not be altered.
Child - Indicates
whether or not the object is a child of another object. A value of 1
is set if it is a child, 0 otherwise. This item should generally not
be altered.
The syntax of a declaration is as follows:
[ ]Type "Name"
( )Tag="Text"
( )Class="ClassName"
( )Parent =iParent
( )Child=iChild
[ ]Type "SubName"
( )Tag="SubText"
( )Class="SubClassName"
( )Parent=iSubParent
( )Child=iSubChild
where,
Name is
the name of the window. This is the name used in the Phantom script.
The Window Declarations Recorder can automatically create this name
based upon the window's text or class.
Text
is the window title, or an index (without
quotes) if the window has no title or is a menu.
ClassName
is the window's class name.
iParent
indicates if the object is a parent (1=it is a parent, 0=it is not a
parent).
iChild indicates
if the object is a child (1=it is a child, 0=it is not a child).
SubName
is the name of the sub item or child
window. This is the name used in the Phantom script.
SubText
is the sub item or child window title.
SubClassName
is the sub item or child window class
name.
iSubParent
indicates if the sub object is a parent.
iSubChild
indicates if the sub object is a child.
Notice that the elements are offset by a tab. This
indicates to the interpreter that the element belongs to the object
defined by Name. Notice also that the child item of the
main item is offset by a tab from the main item. This also serves
the purpose of informing the interpreter that the object is a child
of the previous object. The brackets prior to some of the elements
indicate a main element, with parentheses indicating additional element
information. In this fashion, the interpreter builds a tree
of objects for use by the script.
An example of a window declarations file is:
[ ]MainWin "Help"
( )Tag="Help Topics: Notepad Help"
( )Class="#32770"
( )Parent=1
( )Child=1
[ ]MainWin "#327701"
( )Tag=1
( )Class="#32770"
( )Parent=1
( )Child=1
[ ]MainWin "Click"
( )Tag="Click a..."
( )Class="Static"
( )Parent=0
( )Child=1
[ ]MainWin "SysTreeView321"
( )Tag=1
( )Class="SysTreeView32"
( )Parent=0
( )Child=1
[ ]MainWin "Open"
( )Tag="Open&"
( )Class="Button"
( )Parent=0
( )Child=1
[ ]MainWin "Print"
( )Tag="Print...
&"
( )Class="Button"
( )Parent=0
( )Child=1
[ ]MainWin "Cancel"
( )Tag="Cancel"
( )Class="Button"
( )Parent=0
( )Child=1
[ ]MainWin "SysTabControl321"
( )Tag=1
( )Class="SysTabControl32"
( )Parent=0
( )Child=1
Note that names are derived from the Tag of the object.
If the tag is a number, the name is derived from the class along with
a number. Also, all '.'s are converted to '_'s and '&'s are omitted
in the names.
See Also: The
Window Declarations Recorder, Using
Window Declarations, define, Editing