Search the Community
Showing results for tags 'counter'.
-
Hello, i have been making a countdown timer and its all working just how i like it, its just skipping the 0's en going from 1 - 59 ( it does wait the time needed for the counter to go from 1 - 0 - 59) It just goes from 1 to 59, showing the 1 for the time needed to go from 1 to 0 and then to 59. Here's my code: For $i = 60 To 1 Step -1 Next If $i = 0 Then $Sc = $Sc - 1 EndIf If $Sc = 0 Then $Sc = 0 ;~ <--- Shouldnt this work? Setting it to 0 then wait 1 sec to set it to 59? Sleep(1000) $Mn = $Mn - 1 $Sc = 59 EndIf If $Mn = 0 And $Sc = 0 Then $CDHrs = 0 Sleep(1000) $Mn = 59 EndIf GUICtrlSetData($Countdown, 'Hrs:' & $CDHrs & ' ' & 'Min:' & $Mn & ' ' & 'Sec:' & $Sc) Sleep(1000) I dont need the solution in code, just point me into the general direction where i am going wrong, i'd like to learn from my mistake. Thanks in advance. ~ Maffiagang
- 5 replies
-
- counter
- skip counter
-
(and 3 more)
Tagged with:
-
Hi, Good Day! I have a problem and having difficulty implementing it. I want to copy the files in a certain folder, rename it, and when it exist in the destination folder it will add an index counter. Example source folder having files like: AA_123.TXT BB_123.TXT CC_123.TXT DD_123.TXT After file copy the target folder would be like this: 123.TXT 123_1.TXT 123_2.TXT 123_3.TXT How to achieve this? Thanks in advance
-
I want the number in a file to be overwritten with the next number up each time a button is pressed. So it is pressed once, the number '1' is written to the file. It is pressed again and the number '2' overwrites the first number. At the moment I get the number 1 written, but can't get it to overwrite. What I have so far: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #Region ### START Koda GUI section ### Form=C:\Users\soulf\Desktop\CalcGui\RLCalc.kxf $Form1 = GUICreate("Form1", 615, 437, 426, 141) $One = GUICtrlCreateButton("1", 32, 72, 25, 25) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func First () $fPath = "C:\temp\First.txt" $fOpen = FileOpen ($fPath, 2) $Counter = FileReadLine ($fpath) $counter = $counter + 1 $fWrite = filewriteline ($fPath, $counter) FileClose ($fpath) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $One Call ("First") EndSwitch WEnd I tried a Do Until statement, but that just puts the numbers 1 to 5 in the file. Any help would be greatly appreciated!