Jump to content

Recommended Posts

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.

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

 

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

 

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

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
  • Recently Browsing   0 members

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