Simple Multiple Timer CountDown

Get help with using AutoHotkey and its commands and hotkeys
holahapi
Posts: 61
Joined: 09 Nov 2016, 21:52

Simple Multiple Timer CountDown

26 May 2017, 00:59

I google "ahk count down timer" already, but non of them fit my need.

I want to it able to create multiple timer at the same time.
(I think it need create a Object, but I dont know how and what keyword shlud I use too google the tutoirals)


Here is How I want the timer work.

press a Key(Create a new timer)
show up Inputbox (how many miniutes to Count)
Press Enter
show up Inputbox (Name of the
do something when the Alaram turn off.



I have some code, it dont work for multiple timers
and I dont know how to send the varible to the method

Code: Select all

global alarmName

#F3::


inputbox, alarName,, Insert Alarm Name
inputbox, alarmMin,, Insert Alarm Time
settimer, alarmMe(%alarName%), %alarmMin%
return


alarmMe(name)
{
msgbox, %alarName%
settimer, alarmMe(%alarName%), off
return
}
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Simple Multiple Timer CountDown

26 May 2017, 01:14

This should work. If you type "Alarm1" or "Alarm2" in the first input box, that timer will be activated.

Code: Select all

#F3::
InputBox, AlarmName, Insert Alarm Name
InputBox, AlarmTime, Insert Alarm Time
SetTimer, %AlarmName%, %AlarmTime%
Return

Alarm1:
; contents here
Return

Alarm2:
; contents here
Return
holahapi
Posts: 61
Joined: 09 Nov 2016, 21:52

Re: Simple Multiple Timer CountDown

26 May 2017, 02:00

THank you for your answer

But for the inputbox 1, I want to put some Casual names, such as "Cooking", "Call some one"
Which remind me the what is that alarm for

If I create 1 more inputbox, it will make me confuse which alarm is used, also I want the alarm as simple as possible
Rohwedder
Posts: 3636
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Simple Multiple Timer CountDown

26 May 2017, 03:35

Hallo,
as much timer as you want!
Try:

Code: Select all

F3::
	SetTimer, Alarm, Off
	no++
	inputbox, alarmName%no%,, Insert Alarm Name
	inputbox, alarmTime%no%,, Insert Alarm Time
	alarmTime%no% := A_TickCount + 60000*alarmTime%no%
	SetTimer, Alarm, 1000
Return
Alarm:
	Reset := True
	Loop, %no%
	{
		If alarmTime%A_Index%
		{
			Reset := False
			If (A_TickCount > alarmTime%A_Index%)
			{
				alarmTime%A_Index% =
				MsgBox, % alarmName%A_Index%
				alarmName%A_Index% =
			}
		}
	}
	If Reset
	{
		no = 0
		SetTimer, Alarm, Off
	}	
Return
holahapi
Posts: 61
Joined: 09 Nov 2016, 21:52

Re: Simple Multiple Timer CountDown

26 May 2017, 20:55

Thank you, works fawlessly.
Now, I cant have thousands of timers :D
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Simple Multiple Timer CountDown

27 May 2017, 00:57

Hey that's pretty clever rottweiler. I might use that script myself. :)

Return to “Ask For Help”

Who is online

Users browsing this forum: c7aesa7r, mikagenic, Saarthak Kamra, TXShooter and 34 guests