Jump to content

Click on Text in window


Recommended Posts

Ok, after looking over the help files and searching for hours on the form, I am now at the point of asking for help. I have read several threads where people need the ability to click on certain text in a window. Looks like there has not been a solution to this problem. Ha anyone come up with a solution that does not require mouse movements and coordinates to used. I am creating a script that will be used in a production enviroment to do some performance benchmarks and will have to very carefull that I am clicking on the correct text. If any one can point me in the right direction, I would appreaciate it.

Link to comment
Share on other sites

Thanks for the responce but I have tried controlCLick and it needs to use cordinates. The text could be anywhere on the screen, I would not know the cords. As this is text the image selection would not work unless I create an image for all the text that I would be looking for.

Link to comment
Share on other sites

Here is example (from helpfile) how to enumerate all windows.

You can accomodate it to enumerate also controls inside windows and test its text.

; Create callback function
$handle = DLLCallbackRegister ("_EnumWindowsProc", "int", "hwnd;lparam")     

; Call EnumWindows
DllCall("user32.dll", "int", "EnumWindows", "ptr", DllCallbackGetPtr($handle), "lparam", 10)

; Delete callback function
DllCallbackFree($handle)

; Callback Procedure
Func _EnumWindowsProc($hWnd, $lParam)
    If WinGetTitle($hWnd) <> "" And BitAnd(WinGetState($hWnd), 2) Then
       $res = MsgBox(1, WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & "lParam=" & $lParam & @CRLF & "$hWnd(type)=" & VarGetType($hWnd))
       If $res = 2 Then Return 0  ; Cancel clicked, return 0 to stop enumeration
    EndIf
    Return 1   ; Return 1 to continue enumeration
EndFunc
Link to comment
Share on other sites

Thanks for the help, but I do not have any problems finding windows or manipulating controls, the problem is clicking on specific text on 3rd party controls. The control I am working against is a grid with columns and rows. The problem is that it is not recognized as a table but one big object. Hence I cannot select a roe or column. For this reason I need to select specific text. See the attached image for example of the application. I would need to select a patient name in order to click on the buttons on the left, or to do any thing else with that patient. As this is to be used in production when a customer has problems It has to be accurate on the patient is working on.

post-46274-1242765848_thumb.jpg

Edited by ODell
Link to comment
Share on other sites

It's not a matter of a language, this task is too difficult. Maybe you can send keystrokes ? Like, if there is a search box, you can "type" in there the exact patient number and then there will be only one field to click ?

Or that program you're using has some plugin support or can accept commandline parameters ?

Link to comment
Share on other sites

Any of the "OFF THE SHELF TEST TOOLS" can do a Text Select and click the text in the window, so I know that it can be done. Might have to create my own DLL to do this.

Edited by ODell
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...