Jump to content

Recommended Posts

#Include <WinAPI.au3>

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary")

When I am running this script it just gives me a ConsoleWrite output of "0x001D04A8"

When using "AutoIT v3 Window Info" all the info I need for the ControlClick is there and displayed perfectly as if I typed it in normally.

Upon click the button it should be clicking it, I see the following inn the console window:

Quote

0x001D04A8
1
0
0x001D04A8

If I replace the $ClassName with the actual ClassName of "WindowsForms10.BUTTON.app.0.3296db7_r14_ad1" it works just fine, any ideas???

Edited by Yirrlaar
Link to comment
Share on other sites

  • Moderators

After declaring $ClassName, write the resultant variable to the console. Is the variable what you expect it to be?

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ConsoleWrite($ClassName & @CRLF)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yes, it is 100% exactly as it should be:

#Include <WinAPI.au3>

local $ClassName = _WinAPI_GetClassName(WinGetHandle(WinGetTitle("[ACTIVE]")))
ConsoleWrite($ClassName & @CRLF)
;Give's WindowsForms10.BUTTON.app.0.3296db7_r14_ad1
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:"&$ClassName&"; INSTANCE:1]", "primary")
;does nothing
sleep(60000)
ControlClick(WinGetTitle("[ACTIVE]"), "", "[CLASS:WindowsForms10.BUTTON.app.0.3296db7_r14_ad1; INSTANCE:1]", "primary")
;finally clicks the item it's suppose to

 

Edited by Yirrlaar
Link to comment
Share on other sites

You think that getting the window's class is going to give you the class of the control?  I think you need to output to console your $classname variable, and see that is not the case.

I might believe you if you were getting the class of the focused control inside the active window if your control was in fact focused upon, and the window containing the controls was in fact active.

It's much safer to be explicit in what you are attempting to automate rather than look to active windows.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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

×
×
  • Create New...