amadorc

Need help sending clicks to control

11 posts in this topic

For the life of me, I can't get any data from this button. I'm hoping it's something simple I'm overlooking.

I'm trying to click this button:

>>>> Window <<<<
Title:    Gameshow - Welcome
Class:    eva::0x2903
Position:    586, 95
Size:    636, 679
Style:    0x16CF0000
ExStyle:    0x00040300
Handle:    0x000000000030088A

>>>> Control <<<<
Class:    Button
Instance:    16
ClassnameNN:    Button16
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:16]
ID:    
Text:    Next
Position:    508, 603
Size:    100, 25
ControlClick Coords:    79, 11
Style:    0x52000000
ExStyle:    0x00000000
Handle:    0x00000000001007A6

>>>> Mouse <<<<
Position:    1177, 736
Cursor ID:    0

This is what the function looks like in my program:

ControlClick("Gameshow - Welcome", "" ,"[CLASS:Button; TEXT:Next; INSTANCE:16]")

It returns 0 (error) when I try to use ControlClick. I've tried multiple other functions to gather data from this control but none of them work.

I've tried elevating permissions of the application and the script as well.

Share this post


Link to post
Share on other sites



And by "data" I mean anything indicating the script recognizes its existence.. 

Share this post


Link to post
Share on other sites

Hello amadorc,

Have you tried using only the "Advanced" portion? ...Maybe like this:

ControlClick("Gameshow - Welcome", "", "[CLASS:Button; INSTANCE:16]")

I've always had good luck with using only the Advanced line with ControlClick.

...But this one looks a little weird because most (if not all) of the Advanced lines I've used, have all had no spaces around the semicolons...as in:

[CLASS:Button;INSTANCE:16]

I would try both ways. ...But I'm still a novice with AutoIt. :)  Hope that helps!

bloopie

Share this post


Link to post
Share on other sites

Just tried without the whitespace (no space around semicolons) and without the text parameter, still no change.

Appreciate the help :)

Share this post


Link to post
Share on other sites

Update: Workaround is using the IUIAutomation MS Framework to find the control, still not as clean as I'd like it to be but it works.

Share this post


Link to post
Share on other sites

amadroc and bloopie - Both of you are new so you need to know this - Game automation is not permitted to be discussed in the AutoIt forum. Please see the forum rules if you have any questions on this. Thanks.

If you have a issue that falls within forum rules - we are more than happy to help. To the both of you - have a great weekend.

Cheers!

Bert

Share this post


Link to post
Share on other sites

Wasn't a game, Gameshow is a streaming application.

Share this post


Link to post
Share on other sites

Hello. Do something like this to check that windows/controls exist.

Local $hGameshow = WinGetHandle("Gameshow - Welcome")
ConsoleWrite("hGameshow: " & $hGameshow & @CRLF)
ConsoleWrite("hButton: " & ControlGetHandle($hGameshow,"","Button16") & @CRLF)
ControlClick($hGameshow, "", "Button16")

Saludos

Share this post


Link to post
Share on other sites

Hey Danyfirex,

Yes this was the console output

hGameshow: 0x0003079C
hButton: 0x0004078E

Which is identifying the handles of the control/window.

Share this post


Link to post
Share on other sites

I don't have time to check deeply why that control does not get controlclick event. but You can do using control position.

 

Local $hGameshow = WinGetHandle("Gameshow - Welcome")
WinActivate($hGameshow)
ConsoleWrite("hGameshow: " & $hGameshow & @CRLF)


Local $hControl = ControlGetHandle($hGameshow, "", "Button16")
ConsoleWrite("hButton: " & $hControl & @CRLF)
Local $aPos = ControlGetPos($hGameshow, "", $hControl)
Local $WindowPos = WinGetPos($hGameshow)

Local $iX = $aPos[0] + $WindowPos[0] + 30
Local $iY = $aPos[1] + $WindowPos[1] + 30
MouseMove($iX, $iY, 0)
MouseClick("left")

Saludos

Share this post


Link to post
Share on other sites

@Amadorc: What would you like to see cleaner in IUIAutomation framework?

 

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