Sfikes

If Time = x Then ...

5 posts in this topic

#1 ·  Posted

Hey i have a problem!

This script will activate once the time is 22:05:00 and send a message.
 

#include <Date.au3>


While 1

If _NowTime(5) = "22:05:00" Then
       Send("Hell yea!")
       ExitLoop
EndIf

WEnd


Whenever i try to run my code it doesn't go like it should. It never sends a "Hell Yea" when the time have passed. So i have no idea how to fix this.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try

If _NowTime(5) >= "22:05:00" Then

as you have a exitloop it will only be send once nearby 22:05:00. I suggest: put also a sleep(10) in your loop.

Edited by AutoBert

Share this post


Link to post
Share on other sites

#3 ·  Posted

the condition is correct, and a 1s time window should be sufficient to trap the time. the likely cause is that when the time is reached, you have no input field in focus, so you do not see the keys sent.

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

You also might want to consider using Scheduled Tasks instead if allowed in your environment.  The advantage of doing so is you don't have to have a resident process (your script) tracking the time, but rather pass that task/responsibility to the OS.  Depends on what you are looking to accomplish I guess....

Share this post


Link to post
Share on other sites

#5 ·  Posted

Are you certain the message isn't being sent, what window is active at 22:05:00 ? (Where is the send() sending the message)

Share this post


Link to post
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