Phantom Documentation

[Help Home] [Phantom Home]
The Window Declarations Recorder

The Window Declarations Recorder is a tool used to record information about a window.  This information goes into a Window Declarations structure, and can be saved in a file.  The Window Declarations Recorder simplifies the creation of this data structure.

To use the Window Declarations Recorder, simply drag the cross-haired icon onto the Window you wish to record.  Information about the window the cursor is on is displayed in the edit fields in the Window Declarations Recorder dialog box.  These fields include the name of the window, the window class, the window position in screen coordinates, and information regarding whether or not the window is a parent and/or a child.

If a child level window is recorded, the recorder will automatically find the child's top-level parent and record the entire parent window.  This is due to the fact that the interpreter searches top-level windows when finding a window from a Window Declarations structure. 

After the cursor is on the window to be recorded, release the mouse button and recording will occur automatically.  Information about all menus and child windows associated with the selected window will also be recorded.

Once the information about the window is recorded, you may wish to save the declarations in a declarations file.  To do this, hit the 'Save' button and a save dialog will automatically appear. Select or type the name you wish to save as, and then click Save in the dialog.  The 'Save' dialog will only appear if there is no name in the 'File Name' edit field. If there is a file name in the 'File Name' field, it will overwrite that file if 'Save' is clicked.

If the 'Show File' box is checked, the new declarations file will be displayed in a Declarations Viewer window.  Here you can make any changes you wish to window names or classes. You can the save the file directly from the Declarations Viewer window.

If the 'Truncate Afx' box is checked, the recorder will replace all window classes that begin with 'Afx:' to be replaced with 'Afx:*' and a numeric tag if there is no window text. This is to prevent the recording of window classes that change upon every instance of an application. These 'Dynamic' class names always begin with 'Afx:' and change every time an application is invoked, making it difficult to for the interpreter to find the window. This is circumvented by placing a wildcard in the class name. If this box is not checked, the full dynamic class name will be recorded.

You can also add several window declarations to one file by checking the 'Append' box.  This will cause the Recorder to write new declarations to the existing file indicated in the 'File Name' edit box instead of over-writing it.

The Window Declarations Recorder automatically replaces the following characters in the Name with an underscore ('_').

&.;:,=-~`^#"'()/\*$@!%><[]{}+?

To edit an existing declarations file, enter the path in the 'File Name' field and click 'Open File'. This will open the declarations file in the Declarations Viewer. The declarations can be modified in this window by double-clicking the window to change. A window will appear with the window properties. Change the properties to the new values and click 'OK' and then 'Save' in the main Window Declarations Recorder window to save the changes.

About Window Declarations Names
The Window Declarations Recorder automatically assigns names to the window variables it creates. Generally, these names are the first word of the Tag for these windows. If the window does not have a tag, or has an empty tag, the class information is used. When the class information is used, a number is appended to the class name and the result is used as the name of the window. The number corresponds to the order in the window hierarchy where this window, of this class type appears (equivalent to the numeric tag described in Window Declarations Elements). For example, three empty edit fields would have the names Edit1, Edit2, and Edit3. Any window that uses a numeric tag will default to this format for the window name.

Any non alpha-numeric character in the tag (excluding '_') will be converted to a '_' in the name (as described above). Menu items and controls such as buttons commonly have a hidden '&' character in their tags indicating a special mnemonic character. This '&' is part of the tag, and will be converted to a '_'. Therefore, often a '_' will appear in the name when it is not obvious a non-alpha numeric character is in the window or menu text.

Often times the naming rules the Window Declarations Recorder uses will result in multiple child windows of the same name. The Window Declarations Recorder editor can be used to change these names to something more descriptive. If a window declaration having multiple children of the same name is loaded in to Phantom, each child can be accessed using an array index as described in Using Window Declarations.


An illustration of the Window Declarations Recorder is shown below:



Below is an illustration of the Declarations Viewer/Editor:



See Also: Editing, Using Window Declarations, The Phantom Script Recorder



Copyright 2000-2011 Phantom Automated Solutions