mehafi

How to get control class name or id in win10

15 posts in this topic

Hi,

In win8 I can use AutoIt v3 Window Info to get control Class Name or ID - example printscreen win8_calc_class.png - I can identify any button of calculator

But in win10 the sam action show me the same Class Name ( ApplicationFrameInputSkinWindow1 )  and in fact all data except Control Click Cords are the same for almost entire surface of calculator ( win10_calc_btn_noclass.png ). The same in application writen in C++ QT - I can not identify buttons Refresh and Cancel to click on them, what is my purpose ( tableau_refreshAll_noClass.png ).

Does anyone have any suggestions / solutions ?

thanks in advance

win8_calc_class.png

win10_calc_btn_noclass.png

tableau_refreshAll_noClass.png

Share this post


Link to post
Share on other sites



When the Windows is active and you press Alt do you get an underline below one of the letters on "Refresh" or "Cancel"?

Share this post


Link to post
Share on other sites

@Subz - no, therre are no underlines. I gues what  probably you want to advise - underline means keyboard shortcuts means I could use Send function to 'press' this button.

@junkew - on printscren is what inspect.exe shows me when I point the button in dialog box which I am intrested. So there is no Class Name, Id ... is there a way I can identify this button and press / click on it ?

Inspect_btnResult.png

Share this post


Link to post
Share on other sites

I have tried:

Local $hControl = ControlGetHandle( $hWndRefreshWindow, "", "[TEXT:Close Enter]" )

Local $hControl = ControlClick( $hWndRefreshWindow, "", "", "left")

Local $hControl = ControlClick( $hWndRefreshWindow, "", "", "right")

 

but it not works

Share this post


Link to post
Share on other sites

You may need to use ControlClick with coords.

Share this post


Link to post
Share on other sites

@Subz unfortunatelly it does not works.

I used:

Local $x = ControlClick( $hWndRefreshWindow, "", "", "", 1, 832, 704) ; values returned in Bounded rectangle property by Inspect.exe

Local $x = ControlClick( $hWndRefreshWindow, "", "", "", 1, 235, 290) ; values counted by my related to the top left corner of dialog box

Local $x = ControlClick( $hWndRefreshWindow, "", "", "", 1, 5, 5) ; values related to top left corner of button

Interesting - function return 1 = success, but button is not presed

Share this post


Link to post
Share on other sites

What about:

;~ Cancel Button
If WinActive('[CLASS:QT5QWindow]') Then
    $QT_REFRESH = WinGetPos('[CLASS:QT5QWindow]', '')
    ControlClick('[CLASS:QT5QWindow]', 'Refresh All Extracts', '', 'left', 1, $QT_REFRESH[2] - 50, $QT_REFRESH[3] - 20)
EndIf
;~ Refresh Button
If WinActive('[CLASS:QT5QWindow]') Then
    $QT_REFRESH = WinGetPos('[CLASS:QT5QWindow]', '')
    ControlClick('[CLASS:QT5QWindow]', 'Refresh All Extracts', '', 'left', 1, $QT_REFRESH[2] - 130, $QT_REFRESH[3] - 20)
EndIf

 

Share this post


Link to post
Share on other sites

Unfortunately it not works.

I think the issue is this are QT controls

Share this post


Link to post
Share on other sites

#10 ·  Posted

Can you do ArrayDisplay after WinGetPos, from the WIndows Info Tool it appears to pick up QT5QWindow as the Class.

Share this post


Link to post
Share on other sites

#11 ·  Posted

Strange but:

 Local $hWndRefreshWindow = WinWaitActive("[CLASS:Qt5QWindow]")   ; works and return correct hwnd

bu later:

$QT_REFRESH = WinGetPos("[CLASS:Qt5QWindow]")      ; NOT works

but

$QT_REFRESH = WinGetPos($hWndRefreshWindow)   ; WORKS

 

 

arrayDisplay.PNG

Share this post


Link to post
Share on other sites

#12 ·  Posted

apparently you did not read faq 31 thru with the reference to iuiautomation in examples.

As you can see it with AU3Inf, Simplespy and Inspect its possible to click

Different solutions

  • use the treewalkers in example 1 of uiautomation
  • use the uiawrappers with index n or offset n or relative n
  • use the AutoIt logic of index n

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

So then can you now try:

;~ Refresh Button
MouseClick('left', $QT_REFRESH[0] + $QT_REFRESH[2] - 130, $QT_REFRESH[1] + $QT_REFRESH[3] - 20)

;~ Cancel Button
MouseClick('left', $QT_REFRESH[0] + $QT_REFRESH[2] - 50, $QT_REFRESH[1] + $QT_REFRESH[3] - 20)

Edited by Subz
Typos - Added Cancel

Share this post


Link to post
Share on other sites

#14 ·  Posted

@Subz thanks,  MouseClick works. But I prefer not to use automation required moving mouse cursor if absolutely not needed. But once again thanks for working solution!

 

Share this post


Link to post
Share on other sites

#15 ·  Posted

@junkew I have read FAQ, but have'nt have time to try all solutions. No I have just tried UIAutomation and it works! Thanks a lot! 

Share this post


Link to post
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