DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: simple quick'n'dirty alarm  (Read 15,349 times)

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
IDEA: simple quick'n'dirty alarm
« on: September 12, 2006, 10:23 AM »
I'm sorry I don't know if there is a better place than this in these forums where similar help requests can be posted, so please forgive me and point me to the right forum. Btw, what I want is someone fixing this little script for me, as I can't see where the bug is. Simply I'd like a script where I manually edit the alarm time, and it beeps when the time is passed. It loads fine, no error messages, but it just doesn't work. Thanks in advance, and please don't forget to tell me which is the right place where to post help requests on little coding snacks which probably are not fresh "ideas" and could already exist somewhere...
Code
;Alarm.ahk

alarm=2030 ;alarm time (hhmm)
checkevery=59000 ;time between checks in ms

SetTimer,CHECK,%checkevery%
Return

CHECK:
SetTimer,CHECK,Off
StringMid,now,A_Now,9,4
If (now>=start)
{
	SoundBeep
}
SetTimer,CHECK,%checkevery%,On
Return

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,217
Re: IDEA: simple quick'n'dirty alarm
« Reply #1 on: September 12, 2006, 11:02 AM »
If you just want something that works, why reinvent the wheel?  Would MicroEggTimer do?  When it times out, it keeps beeping until you make an effort to stop it.



insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
Re: IDEA: simple quick'n'dirty alarm
« Reply #2 on: September 12, 2006, 11:36 AM »
Thanks, but it's not what I want. I want an AutoHotKey script so I can change it as much as I like, depending on the situation.

Mainly, I want to use the PC speaker as alarm output, but I want to fine-control the frequency and the repeating cycles of the beep, and change them easily (i.e. editing the script). And when I want to play a wav file instead, I should be able to, having an editable ahk script. Moreover, I don't want the app in the taskbar, so it doesn't bother me when I press Alt-Tab: the ahk script solves this issue too.

The one I've posted would be the best for me, but there's something which prevents it from working, so I ask here help to fix the bug, as I am sadly a big fan of AutoHotKey, but a very beginner in scripting for it ;)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 3,217
Re: IDEA: simple quick'n'dirty alarm
« Reply #3 on: September 12, 2006, 01:00 PM »
I want an AutoHotKey script so I can change it as much as I like

I wondered if you might...  Why not ask in the AHK forums?  That seems the logical place for scripting queries.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: IDEA: simple quick'n'dirty alarm
« Reply #4 on: September 12, 2006, 02:06 PM »
I think that all that should work, although in one of the last lines you should have:

Code
SetTimer,CHECK,On
instead of
Code
SetTimer,CHECK,%checkevery%,On

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
Re: IDEA: simple quick'n'dirty alarm
« Reply #5 on: September 12, 2006, 10:59 PM »
Done! I post it here, if anyone wants to use/improve it. Thanks to Skrommel for his "tutorial" on how to script in AutoHotKey, which is the code itself of his nice and polished scripts :)


EDIT: Still doesn't work... help wanted
« Last Edit: September 14, 2006, 10:09 AM by insert_nick »

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
Re: IDEA: simple quick'n'dirty alarm
« Reply #6 on: September 14, 2006, 10:11 AM »
uhm... it seemed to work with simple tests, but today I've realized it was an illusion: it just triggers after the same amount of time, regardless of the alarm variable. If someone figures out how to fix it I'll be very glad, I'm still not very confident with the AutoHotKey language.

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: IDEA: simple quick'n'dirty alarm
« Reply #7 on: September 14, 2006, 10:19 AM »
That's because you have a small typo, insert_nick.
In the following line,
Code
If (now>=start)
you most probably meant:
Code
If (now>=alarm)

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
Re: IDEA: simple quick'n'dirty alarm
« Reply #8 on: September 14, 2006, 02:07 PM »
Thanks! It was that!  :-[
Attached the fixed version.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: IDEA: simple quick'n'dirty alarm
« Reply #9 on: September 15, 2006, 01:46 AM »
here's some alarm clock scripts from AHK forums that i've used in various ways...

Original address: https://www.donationcoder.com/forum/index.php?topic=5231.0