Phantom Documentation

[Help Home] [Phantom Home]
Using Window Functions

Window functions are accessed like any member function. To use a function, append the window variable with a period ('.') followed by the function name and parameters. To use a function on a child window, the entire window hierarchy must be used. The window variable must exist either from a window declarations file or using the MainWin function.

The syntax for window functions is:

Return = MainWin.ChildWin(s).Function(Parameters);

where,

MainWin - The main parent window to perform the function on
Function - The function to perform
Return - The return value of the function, if applicable
ChildWin(s) - The child window tree if the function is to be performed on a child of MainWin. There can be any number of child windows, each one separated by a period (.). There are no child windows in the statement if the function is to be performed on the main window  
Parameters - The parameters of the function, if applicable

The following example code illustrates the use of window functions:

Example Code

# Include windows from a declarations file
use "Notepad.dec";
System("c:\\windows\\system32\\Notepad.exe");

# Function on the MainWin
Notepad.MoveWin(100,100);

# Function on the Menus
Notepad._Edit._Find___.Select();

#Function on a Child Window
Notepad.Edit1.SetText("Hello");

# Function on a window created using MainWin
window Find = MainWin("Find", "#32770");
Find.Close();

# Clear the child text
Notepad.Edit1.SetText("");

# Function on the Menus
Notepad._File.E_xit.Select();



See Also:
Functions, Window Declarations, Creating a Script


Copyright 2000-2011 Phantom Automated Solutions