Messages - theotherone [ switch to compact view ]

Pages: [1]
1
Post New Requests Here / Re: IDEA: Counter request +1/-1
« on: May 17, 2013, 06:22 AM »
Hi, I came across this earlier while getting a key for FARR and decided to try something.

I tried to implement the requested functionality in a AutoHotkey script:
; Variables
; ====================================================
global counter := 0
global goal := 0

global counterText := "Current count: "
global goalText := "Counting towards goal: "

; ====================================================
Main:
Gui +AlwaysOnTop -ToolWindow -MinimizeBox
Gui, Font, underline
Gui Add, Text, w150 x15 y15 gSetGoal vgoal cBlue, %goalText%%goal%
Gui, Font, norm s12
Gui Add, Text, w150 h25 x15 y50 vcounter, %counterText%%counter%
Gui Show

; Hotkeys
; ====================================================
Up::
counter++
goto RefreshGui
return

Down::
counter--
goto RefreshGui
return


; Subroutines
; ====================================================
GuiClose:
GuiEscape:
Gui, Cancel
ExitApp

SetGoal:
tmpGoal := goal

Gui -AlwaysOnTop
InputBox goal, , Set the goal count:, , 150, 120
if ErrorLevel
{
goal := tmpGoal
}
if goal =
{
goal := tmpGoal
}
Gui +AlwaysOnTop
goto RefreshGui
return

RefreshGui:
GuiControl text, goal, %goalText%%goal%
GuiControl text, counter, %counterText%%counter%

if % counter = goal
{
Gui -AlwaysOnTop
MsgBox, , , Goal Reached!
Gui +AlwaysOnTop
}
return

Pages: [1]
Go to full version