quentin Posted December 8, 2005 Share Posted December 8, 2005 Hi all,I've wrote this code : #include <Array.au3>HotKeyset("^!x", "MyExit") MsgBox(0,'Iddq_Esp06',"depart ?") $avArray = _ArrayCreate("713", "1323", "1933", "2543", "3153", "3763", "4372", "4982", "5594", "6204", "6814", "7424", "8034", "8644", "9254", "9864", "10474", "11084", "11694", "12304") _ArrayReverse( $avArray) While UBound($avArray) > 0 MouseClickDrag ( "left", 146, 234, 90, 234) Send(_ArrayPop($avArray)) MouseClick ( "left", 218, 54, 1, 2) sleep(5000) ControlFocus("UserForm1", "", "") MouseClick ( "left", 563, 533, 1, 2) ControlFocus("HILEVEL TestStationNT", "", "") sleep(1500) Wend MouseClick ( "left", 270, 53, 1, 2) Exit Func MyExit() ExitEndFuncMy problem is it's not working as i wished...In fact at the first iteration of the loop, everything is OK but at the second one and all next the ControlFocus seems not working (the window didn't show up)Did somebody see a problem in my code ?Thx Link to comment Share on other sites More sharing options...
GaryFrost Posted December 8, 2005 Share Posted December 8, 2005 I'm going to take a guess as to why this isn't working I suspect the control in question initially has focus, ergo 1st time around it works your attempting to use ControlFocus with-out an controlID, so i suspect it can't set focus to the control you want to have focus. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
quentin Posted December 9, 2005 Author Share Posted December 9, 2005 your attempting to use ControlFocus with-out an controlID, so i suspect it can't set focus to the control you want to have focus.I did it because the autoit window info didn't show any ControlID for these windows. Is there any default value ? Link to comment Share on other sites More sharing options...
MHz Posted December 9, 2005 Share Posted December 9, 2005 Since you are not focusing a control but are wanting to activate the entire window for MouseClick() and Send(), then you could just use WinActivate() instead of ControlFocus() ? Link to comment Share on other sites More sharing options...
quentin Posted December 9, 2005 Author Share Posted December 9, 2005 Thx, it's working with winactivate. Did somebody can explain me the differences between these two functions ? Link to comment Share on other sites More sharing options...
MHz Posted December 9, 2005 Share Posted December 9, 2005 (edited) Glad it works now.ControlFocus() is used to focus a control within a given window. This helps to do actions with the chosen control.WinActivate() brings the window to the front as the active window so functions that rely on active windows can send to them.Send() emulates the keyboard and Mouse*() functions emulate the mouse. Normally they do require an active window to communicate successfully. Since you cannot see the controls then ControlFocus() could do more harm then good. WinActivate() will simply activate the window without interfering with the last control that had focus so you could just continue with your Send() and MouseClick(). If you need to move around the controls then normally Send('{TAB}') will move the focus around. Edited December 9, 2005 by MHz 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