topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday March 28, 2024, 8:48 am
  • 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

Author Topic: IDEA: simple quick'n'dirty alarm  (Read 11345 times)

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
    • View Profile
    • @insert_nick
    • Donate to Member
IDEA: simple quick'n'dirty alarm
« on: September 12, 2006, 05: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...
;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
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #1 on: September 12, 2006, 06: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
    • View Profile
    • @insert_nick
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #2 on: September 12, 2006, 06: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
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #3 on: September 12, 2006, 08:00 AM »
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

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #4 on: September 12, 2006, 09:06 AM »
I think that all that should work, although in one of the last lines you should have:

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

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
    • View Profile
    • @insert_nick
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #5 on: September 12, 2006, 05: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, 05:09 AM by insert_nick »

insert_nick

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 76
    • View Profile
    • @insert_nick
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #6 on: September 14, 2006, 05: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

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #7 on: September 14, 2006, 05:19 AM »
That's because you have a small typo, insert_nick.
In the following line,
If (now>=start)
you most probably meant:
If (now>=alarm)


insert_nick

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

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: simple quick'n'dirty alarm
« Reply #9 on: September 14, 2006, 08:46 PM »
here's some alarm clock scripts from AHK forums that i've used in various ways...