Macro Scheduler 15

GetControlText

GetControlText>WindowTitle,ClassName,Instance,Result

 

Returns the text of the control specified by ClassName and Instance on the window specified by WindowTitle.

 

Result contains the text of the control if found.  It the window is not found Result contains ##NOSUCHWINDOW##.  If the class and instance was not found ##NOSUCHOBJECT## is returned.

 

If WIN_USEHANDLE is set to 1 WindowTitle must be a window handle.

 

To determine class names of objects on windows use View System Windows.  A window may contain several objects of the same class name.  Instance is used to determine which instance of the class to use.

 

GetControlText retrieves the published text property of the specified object.  Not all text that you see on the screen is retrievable in this way.  Some text is painted via lower level routines and some text is graphical.  Some objects, such as labels, are not windowed controls, and therefore text associated with them cannot be retrieved with GetControlText.   Try the new GetTextAtPoint, GetTextInRect and GetWindowTextEx commands which use lower level hooks to trap more text.

 

WintowTitle can end with an asterisk to indicate a substring match.  WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted.  See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.

 

 

Abbreviation: GCT

See also: SetControlText, GetTextAtPoint, GetTextInRect, GetWindowTextEx, WaitScreenText

 

Example:

 

GetControlText>Notepad*,Edit,1,npEdit

 

npEdit will now contain the contents of the notepad edit window.