topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 23, 2024, 2:25 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


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]