Jump to content

If Time = x Then ...


 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

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....

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...