Jump to content

help with alarm....


Recommended Posts

ok well im making a simple alarm, it hits the time, i wake up... lol, all it does is once it hits the certain time, it presses "x" witch on my computer presses play for winamp, thus started the most annoying song in the world, causing me to wake up.... but for some reason my "Wend" wont match my "While".... can someone help me out here, here's my code....

HotKeySet("{ESC}", "Terminate")

$Time = _NowTime(5)

    While 1
If $Time = "12:11:30" Then
            Send("x")
    WEnd

    Func Terminate()
        Exit 0
    EndFunc
Link to comment
Share on other sites

Storing the value of _NowTime(5) is only once done. If you want to continually check, then you are going to have run the function with each loop.

HotKeySet("{ESC}", "Terminate")

While 1
    $time = _NowTime(5)
    If  $time = "12:11:30" Or Then Send("x")
WEnd

Func Terminate()
    Exit 0
EndFunc

It will probably make your cpu work hard without Sleep(), but you would need to create a better concept to check time as this is too precise to hit the target time.

Link to comment
Share on other sites

ok well im making a simple alarm, it hits the time, i wake up... lol, all it does is once it hits the certain time, it presses "x" witch on my computer presses play for winamp, thus started the most annoying song in the world, causing me to wake up.... but for some reason my "Wend" wont match my "While".... can someone help me out here, here's my code....

HotKeySet("{ESC}", "Terminate")

$Time = _NowTime(5)

    While 1
If $Time = "12:11:30" Then
            Send("x")
    WEnd

    Func Terminate()
        Exit 0
    EndFunc

ill help you out Tk_Incorporate, what your script is missing is an "EndIf" command...Without an EndIf command, the scipt sometimes gives you an error related to While or WEnd...in fact, i had the same problem with my own script today, lol... Her, this is what your script is really supposed to look like...oh, and also, your "Then" is supposed to be the last word in an "If" command...the statements to be executed are supposed to be in the next line, and I also dont get the point of "Or" after the time.

#include <Date.au3>
HotKeySet("{ESC}", "Terminate")
While 1
    $Time = _NowTime()
    If $Time = "12:11:30 PM" Then
        Send("x")
        ExitLoop
    EndIf
WEnd
Func Terminate()
    Exit 0
EndFunc;==>Terminate

Here is the corrected script, i tested it, it works, except i did not wait for the time to come, I just tested for errors...Ill tell you what was wrong with your script. First, you forgot to "#include <Date.au3>", which is required here(please look at example). And also, I added the line "ExitLoop". I added this line because once that time comes, the script will again and again press "x", so if you want to press x ONLY ONCE, you will have to put the line "Exitloop"...And I advise you to get "SciTe" if you don't already have it, its an awsome text editor, for AutoIt and others...I just got it today too, helped me out a lot...

PS. Don't be fooled by my posts, even though I didn't post a lot doesn't mean I suck lol...and also don't be fooled by my neat typing, I type crappily, this is just my first post where I actually helped someone else out...also, SciTe is on the auto it website..GET IT!!! o and also please tell me how i can make my own cool looking sig plz...and if this helped you out please let me know, PM or post here...Thank you...and dude, if u sleep too long, ur comp will go in standby mode...theres 2 kinds of standby, one that turns off monitor, and one that turns off hard disks...the monitor one is fine, but by default ur hard disks turn off after 1 hour and wen that happens, all running programs stop(i think, 90% sure) so if u need a script that moves ur mouse every 45 minutes or so, u can ask me, i already have one made for myself. FORGOT TO MENTION ONE THING...i also added "PM" after the time...i assumed it would be PM i dunno, just make it "AM" ifu intend it to be AM...sorry for making such a puny thing such a long post...its just my first time helping sumone else out on autoit forums lol

EDITED LIKE 4 TIMES

GodandRock leaves his mark. ^*+-._.-+*^(|{[\:=^*+-._ GAR _.-+*^=:/]}*^|)^*+-._.-+*^

Edited by GodandRock

[font="Fixedsys"][size="3"][u][font="Franklin Gothic Medium"] [/font][/u][/size][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...