Jump to content

why Controlclick did not click the button


Recommended Posts

Hi,

There is a small window popout and I want to click the ok button and so I issue the controlclick command but it does not click. Whats wrong with my code?

The window info below.

Thanks

------------ my code ------------

ControlFocus ( "Select a Camera", "ok", 1 )

ControlClick ( "Select a Camera", "ok", "1","Left",1 )

------------------------------------

********* window info ******************

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: Select a Camera

Class: #32770

Size: X: 673 Y: 126 W: 312 H: 158

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 778 Y: 254

Cursor ID: 2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0xD6D3CE Dec: 14078926

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 65 Y: 99 W: 75 H: 23

Control ID: 1

ClassNameNN: Button1

Text: OK

Style: 0x50010001

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

OK

Cancel

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

Link to comment
Share on other sites

Sometimes gui's have buttons that are build above each other. Sounds strange, but you can have that effect if you play with the settings\software\windows-components (?). At some point, you click next and get back.

Maybe you focus the ok-button and find out the control-name to press that button later.

$a = ControlGetFocus("Select a Camera")
MsgBox (0, 'Focus', 'And the winner is:'&@CR&$a)
Link to comment
Share on other sites

Ok, now I know my problem. Looking at the windowInfo, therefore

(1) My original code ControlClick ( "Select a Camera", "ok", "1","Left",1 )

is wrong because "ok" and "OK" is different and the window info says the text is 'OK'. So strings are case sensitive.

(2) I also realise that in the controlclick command, under the controlID, that if I put 1 enclosed by doublequotes, than it is wrong, it wont work. The working way is this ---> ControlClick ( "Select a Camera", "OK", 1,"Left",1 )

and not this which is wrong -----> ControlClick ( "Select a Camera", "OK", "1" ,"Left",1 )

Many thanks to members and also dabus for showing me the function ControlGetFocus. Another very interesting observation I have observed.

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 65 Y: 99 W: 75 H: 23

Control ID: 1

ClassNameNN: Button1

Text: OK

--------------------------------------------------------------

post-22053-1177203634_thumb.jpg

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...