ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Simple Counter Utility Wanted

<< < (2/3) > >>

Winkie:
Of cource I can't beat skwire ;D, but this is how I like it:



--- Code: Autohotkey ---#NoEnv#SingleInstance, ForceSetBatchLines, -1SetControlDelay, -1 iMyCount := 0bAllowUpdate := True Gui, 1:+LabelMainGuiGui, 1:Margin, 5, 5Gui, 1:Font, s30Gui, 1:Add, Text, xm w200 h100 0x1200 Center Section vCounterCtrl, % iMyCountGui, 1:FontGui, 1:Add, Button, ys w75 h25 Section vInput_btn gInputValue, SetGui, 1:Font, w700Gui, 1:Add, Button, xs ys+45 w75 h25 gCountUp, +1Gui, 1:Add, Button, xs w75 h25 gCountDown, -1Gui, 1:FontGui, 1:Add, Checkbox, xm w138 h25 Checked vbDoHourCount gToggleHourCount, Count up on the hourGui, 1:Add, Checkbox, x+5 w138 h25 vbAllowNegatives, Allow negative valuesGui, 1:Show, Center, CountAM SetTimer, HourCount, 1000Return MainGuiClose:MainGuiEscape:{        ExitApp}Return CountUp:{        iMyCount++        FormatAndUpdate( iMyCount )}Return CountDown:{        Gui, 1:Submit, NoHide        If Not bAllowNegatives        {                If iMyCount                        iMyCount--        }        Else                iMyCount--        FormatAndUpdate( iMyCount )}Return HourCount:{        FormatTime, iMyNow, A_Now, HHmm        If ( Mod( iMyNow, 100 ) = 0 ) ; We're at the top of an hour.        {                If ( bAllowUpdate = True )                {                        ; Increase counter by one and then don't allow any more increases until this minute is up.                        Gosub, CountUp                        bAllowUpdate := False                }        }        Else        {                bAllowUpdate := True        }}Return ToggleHourCount:{        Gui, 1:Submit, NoHide        If bDoHourCount                SetTimer, HourCount, 1000        Else                SetTimer, HourCount, Off}Return InputValue:{        Gui, 1:+Disabled        Gui, 2:+LabelInputGui +Owner1        Gui, 2:Margin, 12, 12        Gui, 2:Add, Edit, xm w80 r1 Number         Gui, 2:Add, UpDown, Range-32767-32767 viMyInput        Gui, 2:Add, Button, x+15 w80 Default gNewInput, OK        Gui, 2:Show, Center, Enter a value}Return InputGuiClose:InputGuiEscape:{        Gui, 1:-Disabled        Gui, 2:Destroy}Return NewInput:{        Gui, 2:Submit, NoHide        Gui, 2:+OwnDialogs        If Not iMyInput        {                MsgBox, 36, Please confirm, Do you really want the value to be blank?                IfMsgBox No                        Return        }        Gui, 1:-Disabled        Gui, 2:Destroy        Gui, 1:Default        FormatAndUpdate( iMyInput )        iMyCount := iMyInput        iMyInput :=}Return ; FormatInteger -- by WinkieFormatAndUpdate( Int ){        vVar := Int        If vVar < 0        {                vMinus := "-"                StringTrimLeft, vVar, vVar, 1        }        Loop        {                If vVar > 999                {                        StringLen, vLen, vVar                        vTrim := vLen - 3                        StringTrimLeft, vPart, vVar, % vTrim                        vOut := "." vPart vOut                        StringTrimRight, vVar, vVar, 3                }                Else                        Break        }        Gui, 1:Default        GuiControl, Text, CounterCtrl, % vMinus vVar vOut}

skwire:
Nice job, Winkie.  Well done.   :Thmbsup:

AndyM:
This is what I ended up with.


skwire:
Nice, AndyM.  What are you using it for?

AndyM:
Counting  ;D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version