In
order for a script to recognize and interact with a window, often it
is best to use a Window Declarations file. This file contains information
about the window and can be created using the The
Window Declarations Recorder.
The 'use' keyword is required
to include the Window Declarations in the script. 'use', followed
by the full path and file name (unless the interpreter, script, and
declaration file are in the same directory - then only the file name
is required), and then a semi-colon (;), includes a window declaration
file for use. Note that the file name must be placed in double quotes
(").
When the interpreter reads a 'use' statement, it
opens the file in the quotes and parses the information into a window
variable. That window and all child windows can then be used in
the script.
Example
Code |
use
"Notepad.dec";
System("c:\\windows\\system32\\Notepad.exe");
# These windows are defined in
# the 'Notepad.dec' file
Notepad._File._Open___.Select();
Open.Cancel.Click();
Notepad._File.E_xit.Select(); |
Note that if multiple child windows have
the same name, they can be accessed through an array index. For example,
if three child windows have the name 'Sample', they can be accessed through
the names 'Sample[0]', 'Sample[1]', and 'Sample[2]'. See Arrays
for more information about array indexing, and see the Button
function page for an example of accessing multiple child windows with
the same name.
See Also:
Window Declarations, Syntax,
use