lesar Posted May 13, 2009 Share Posted May 13, 2009 how to stop countdown by using STOP or X button ? #include <GUIConstantsEx.au3> GUICreate(" klikor", 210,80, @DesktopWidth/2, @DesktopHeight/2) $file_1 = GUICtrlCreateInput ( "", 10, 5, 30, 20) $file_2 = GUICtrlCreateInput ( "", 60, 5, 30, 20) $file_3 = GUICtrlCreateInput ( "", 110, 5, 30, 20) $Button_1 = GUICtrlCreateButton ("OK",60,50,40, 20) $Button_2 = GUICtrlCreateButton ("STOP",110,50,40, 20) $wynik=GUICtrlCreateLabel("",10,50,40,20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $Button_1 Then $file=GUICtrlRead($file_1)+GUICtrlRead($file_2)*60+GUICtrlRead($file_3)*3600 for $i=$file to 0 step -1 GUICtrlSetData($wynik,$i) $msg=guigetmsg() sleep(1000) if $msg=$GUI_EVENT_CLOSE or $msg=$Button_2 Then EXITloop next endif Wend Link to comment Share on other sites More sharing options...
WideBoyDixon Posted May 13, 2009 Share Posted May 13, 2009 expandcollapse popup#include <GUIConstantsEx.au3> GUICreate(" klikor", 210, 80, @DesktopWidth / 2, @DesktopHeight / 2) $file_1 = GUICtrlCreateInput("", 10, 5, 30, 20) $file_2 = GUICtrlCreateInput("", 60, 5, 30, 20) $file_3 = GUICtrlCreateInput("", 110, 5, 30, 20) $Button_1 = GUICtrlCreateButton("OK", 60, 50, 40, 20) $Button_2 = GUICtrlCreateButton("STOP", 110, 50, 40, 20) $wynik = GUICtrlCreateLabel("", 10, 50, 40, 20) GUISetState(@SW_SHOW) $fRunning = False $nCount = 0 $iTimer = 0 $sLast = "" While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Button_1 Then If Not $fRunning Then $nCount = GUICtrlRead($file_1) + GUICtrlRead($file_2) * 60 + GUICtrlRead($file_3) * 3600 $fRunning = True $iTimer = TimerInit() EndIf EndIf If $msg = $Button_2 Then If $fRunning Then $fRunning = False GUICtrlSetData($wynik, "") EndIf EndIf If $fRunning Then $nTDiff = TimerDiff($iTimer) $sThis = String($nCount - Int($nTDiff / 1000)) If $sThis <> $sLast Then $sLast = $sThis GUICtrlSetData($wynik, $sThis) EndIf If $sThis = "0" Then $fRunning = False Msgbox(64, "Timer", "Finished") GUICtrlSetData($wynik, "") EndIf EndIf Sleep(10) WEnd WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
bogQ Posted May 13, 2009 Share Posted May 13, 2009 quik edit #include <GUIConstantsEx.au3> Global $file GUICreate(" klikor", 210,80, @DesktopWidth/2, @DesktopHeight/2) $file_1 = GUICtrlCreateInput ( "", 10, 5, 30, 20) $file_2 = GUICtrlCreateInput ( "", 60, 5, 30, 20) $file_3 = GUICtrlCreateInput ( "", 110, 5, 30, 20) $Button_1 = GUICtrlCreateButton ("OK",60,50,40, 20) $Button_2 = GUICtrlCreateButton ("STOP",110,50,40, 20) $wynik=GUICtrlCreateLabel("",10,50,40,20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit if $msg = $Button_1 Then If $file = "" Then $file=GUICtrlRead($file_1)+GUICtrlRead($file_2)*60+GUICtrlRead($file_3)*3600 EndIf AdlibEnable ( "function" ,1000 ) endif if $msg = $Button_2 Then AdlibDisable() endif Wend Func function() If $file <> 0 Then $file = $file -1 GUICtrlSetData($wynik,$file) $msg=guigetmsg() EndFunc or you can try timedif TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
lesar Posted May 13, 2009 Author Share Posted May 13, 2009 big thx Link to comment Share on other sites More sharing options...
GEOSoft Posted May 13, 2009 Share Posted May 13, 2009 (edited) another method would be to set a hotkey to exit the loop. #include <GUIConstantsEx.au3> Global $file GUICreate(" klikor", 210,80, @DesktopWidth/2, @DesktopHeight/2) $file_1 = GUICtrlCreateInput ( "", 10, 5, 30, 20) $file_2 = GUICtrlCreateInput ( "", 60, 5, 30, 20) $file_3 = GUICtrlCreateInput ( "", 110, 5, 30, 20) $Button_1 = GUICtrlCreateButton ("OK",60,50,40, 20) $Button_2 = GUICtrlCreateButton ("STOP",110,50,40, 20) $wynik=GUICtrlCreateLabel("",10,50,40,20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE, $Button_2 ExitLoop Case $Button_1 If $file = "" Then $file=GUICtrlRead($file_1)+GUICtrlRead($file_2)*60+GUICtrlRead($file_3)*3600 HotKeySet("{End}", "Dummy") for $i=$file to 0 step -1 GUICtrlSetData($wynik,$i) sleep(1000) If @HotKeyPressed() = "{End}" Then HotKeySet("{End}") ExitLoop EndIf next EndIf Case Else EndSwitch Wend Func Dummy() ; EndFunc Edited May 13, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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