jimmyjmmy Posted April 21, 2007 Share Posted April 21, 2007 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 More sharing options...
Shevilie Posted April 21, 2007 Share Posted April 21, 2007 Try this ControlFocus ( "Select a Camera", "", "Button1" ) ControlClick ( "Select a Camera", "", "Button1") Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
dabus Posted April 21, 2007 Share Posted April 21, 2007 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 More sharing options...
jimmyjmmy Posted April 22, 2007 Author Share Posted April 22, 2007 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: 23Control ID: 1ClassNameNN: Button1Text: OK-------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now