Killerthibs Posted October 17, 2007 Share Posted October 17, 2007 (edited) Hello all Here is an example of script which doesn't work if the GUI is minimize, or unfocus. #include <GUIConstants.au3> #Include <Date.au3> $test = GUICreate("test", 327, 173, 193, 125) $check = GUICtrlCreateCheckbox("check1", 136, 104, 57, 17) $inputHeure = GUICtrlCreateInput("", 88, 45, 33, 21) $label1 = GUICtrlCreateLabel("H", 128, 48, 12, 17) $inputMinute = GUICtrlCreateInput("", 176, 45, 33, 21) $label2 = GUICtrlCreateLabel("MIN", 216, 48, 24, 17) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() $time = _DateTimeFormat( _NowCalc(),5) $heure = ControlGetText("", "", $inputHeure) $min = ControlGetText("", "", $inputMinute) If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If ControlCommand("", "", $check, "IsChecked", "") = 1 And $time = $heure&":"&$min&":00" Then MsgBox(0, "", "C'est l'heure !!") EndIf WEnd Is there a way to resolve that problem, or is it a limit of AutoIt? Thank you very much Edited October 17, 2007 by Killerthibs Link to comment Share on other sites More sharing options...
Nahuel Posted October 17, 2007 Share Posted October 17, 2007 Are you trying to know if "check1" is checked with this? ControlCommand("", "", $check, "IsChecked", "")=1 Use this instead: GUICtrlRead($check)=$GUI_CHECKED Link to comment Share on other sites More sharing options...
Killerthibs Posted October 18, 2007 Author Share Posted October 18, 2007 That doesn't matter, the code here is just un example of a code which doesn't work if the script hasn't got focus. So my question is just: How to make that script, for example, works without the focus? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted October 18, 2007 Share Posted October 18, 2007 $heure = ControlGetText("", "", $inputHeure) This is saying get the active window, with what ever text, and look for that command. You aren't specifying any specific window to look for so of course the window has to be active because it grabs what ever window is active meaning if you GUI isn't the active one it won't do what you want. I'd recommend not using Control.... with GUI as there are other and more functions that will do it more successfully. 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