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.
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.
Abbreviation: GCT
GetControlText Example
GetControlText>Notepad*,Edit,1,npEdit
npEdit will now contain the contents of the notepad edit window.
GetTextAtPoint
GetTextAtPoint>x,y,result_variable,char_pos
Retrieves the text at the specified screen position. Any text retrieved is returned in result_variable. char_pos returns the zero-based index in result_variable of the character at position x,y.
GetTextInit must be called before this function will work.
Abbreviation: GTA
GetTextAtPoint Example
GetTextInit
GetTextAtPoint>200,400,strText,nChar
if>nChar>-1
MidStr>strText,nChar,1,sChar
Endif
MessageModal>%strText% (%sChar%)
GetTextInit
GetTextInit
Loads the text capture hooks. Must be called before any of the following functions will work:
- GetTextAtPoint
- GetTextInRect
- GetTextPos
- GetWindowTextEx
- WaitScreenText
Failing to call GetTextInit before calling any of the above may result in an error.
GetTextInRect
GetTextInRect>left,top,right,bottom,result_variable
Retrieves text found in the screen rectangle bound by coordinates left,top and right,bottom.
GetTextInit must be called before this function will work.
Abbreviation: GTI
GetTextInRect Example
GetTextInit
GetTextInRect>0,0,200,400,strText
MessageModal>strText
GetTextPos
GetTextPos>text_to_find,left,top,right,bottom
Searches the screen for the specified text and if found returns the containing rectangle's (left,top,right,bottom) screen coordinates.
If the text is not found left, top, right and bottom will all be set to -1.
The text can contain regular expressions.
GetTextInit must be called before this function will work.
Abbreviation: GTI
GetTextPos Example
GetTextInit
GetTextPos>File,X1,Y1,X2,Y2
//click in center
Let>x={%X1%+((%X2%-%X1%) div 2)}
Let>y={%Y1%+((%Y2%-%Y1%) div2)}
MouseMove>x,y
LClick
GetTextReset
GetTextReset
Does the same as GetTextInit
GetWindowText
GetWindowText>window_title,text
GetWindowText retrieves all the detectable text contained within the specified window. Specify the window using the exact window title. The text is retrieved as a list with each object's text on a new line.
If the WIN_USEHANDLE variable is set to 1 window_title must be a window handle.
GetWindowText retrieves the published text property of the specified window/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 GetWindowText. Try the new GetTextAtPoint, GetTextInRect and GetWindowTextEx commands which use lower level hooks to trap more text.
Abbreviation : GWT
GetWindowText Example
GetWindowText>Document - WordPad,WordPadTextGetWindowTextEx
GetWindowTextEx>window_title,text
Retrieves visible text in the specified window. Unlike GetWindowText which works by accessing each object's published text property GetWindowTextEx uses lower level hooks to detect all text written to the screen and therefore is capable of capturing far more text.
The specified window is momentarily focused when the function is called.
GetTextInit must be called before this function will work.
Abbreviation: GWE
GetWindowTextEx Example
GetTextInit GetWindowTextEx>Document - WordPad,WordPadText
WaitScreenText
WaitScreenText>text
Waits for the specified text to appear on the screen.
The system variable WST_TIMEOUT can be used to set the number of seconds after which this command should timeout. If set to zero (the default) the timeout will not occur and the command will continue indefinitely. If the command completes within the timeout period the value WST_RESULT will be set to TRUE. Otherwise WST_RESULT will be false.
Abbreviation: WST
WaitScreenText Example
WaitScreenText>Done
MessageModal>Complete
Comments
0 comments
Please sign in to leave a comment.