Search the Community
Showing results for tags 'exit gui'.
-
Hi all and thank you for your help. I have been working on a log-out for a gui and some times this code will not work. How do I get past AM and PM? Edit 1 Ok i think I have it. Thanks Valuater https://www.autoitscript.com/wiki/Snippets_(_Time_%26_Date_) Edit 2 Still not there... Please help. #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Time Machine", 252, 117, 2421, 445) GUISetBkColor(0xA6CAF0) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Checkbox1 = GUICtrlCreateCheckbox("Exit GUI ", 24, 24, 105, 25) $Date1 = GUICtrlCreateDate(" ", 136, 24, 98, 24, $DTS_TIMEFORMAT) $Label1 = GUICtrlCreateLabel("00:00:00 ", 136, 72, 93, 20) GUIctrlSetData($Label1, _Time()) $Button1 = GUICtrlCreateButton("Start", 24, 72, 75, 25) GUICtrlSetOnEvent($Button1, "_Func_1") $Button2 = GUICtrlCreateButton("Stop", 24, 72, 75, 25) GUICtrlSetOnEvent($Button2, "_Func_2") GUICtrlSetState($Button2, $GUI_HIDE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_COMMAND_STOP") Global $stop = 0; set exitloop flag While 1 Sleep(100) WEnd Func _Func_1() GUICtrlSetState($Button1, $GUI_HIDE); Hide and show start and stop GUICtrlSetState($Button2, $GUI_SHOW) While 1 Sleep(1000) If $stop <> 0 Then ; set exitloop Return EndIf If _IsChecked($Checkbox1) Then; check for checkbox to exit Local $set = GUICtrlRead($Date1) Local $tm = _Time() If $set < $tm Then Exit EndIf EndIf GUICtrlSetData($Label1, $tm ); set lable time WEnd EndFunc ;==>_Func_1 Func _Time() Local $hour = @HOUR, $AMPM = "AM" If $hour > 11 Then $AMPM = "PM" If $hour = 0 Then $hour = 12 If $hour > 12 Then $hour -= 12 Return $hour & ":" & @MIN & ":" & @SEC & " " & $AMPM EndFunc ;==>_Time Func _Func_2();====================================== Set button 1 to show and hide button 2 GUICtrlSetState($Button2, $GUI_HIDE) GUICtrlSetState($Button1, $GUI_SHOW) $stop = 0 EndFunc ;==>_Func_2 Func _IsChecked($idControlID);===================== Look for Checkbox ====================== Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _COMMAND_STOP($hWnd, $Msg, $wParam, $lParam); Set $Interrupt to stop loop If BitAND($wParam, 0x0000FFFF) = $Button2 Then $stop = 1 Return $GUI_RUNDEFMSG EndFunc ;==> _COMMAND_STOP Func _Exit() Exit EndFunc ;==>_Exit
-
Hi!, Please can anyone help me with my script, because i cannot close the GUI after clicking on the link. #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 146, 80, 192, 124) $Label1 = GUICtrlCreateLabel("Link that Opens Google", 16, 32, 116, 17) GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Label1 $oIE = _IECreate ("[url="http://www.google.com"]www.google.com[/url]") EndSwitch WEnd Thank You.
- 8 replies
-
- cannot close gui
- gui cannot close
- (and 4 more)