Jump to content

Run Script at a particular time. Can this be done?


MaCgyver
 Share

Recommended Posts

  • Moderators

This should work:

#Include <Date.au3>



While 1
$Time = _NowTime(4)
    If $Time == "hh:mm" Then;change hh:mm to whatever time you want it to run
        ExitLoop
    Else
        Sleep(500);you can make this longer if you don't need it to be exact
    EndIf
WEnd
;Whatever function you want to run here

Edit: I had the variable outside the while statement

Edit: And an EndIf

Edited by big_daddy
Link to comment
Share on other sites

moin, moin...:geek:!

try something like this:

If @WDay = 1 Then
    Sleep(90000)
        RunFunction()
    Else
        Exit
EndIf
:o moin?

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Link to comment
Share on other sites

  • Moderators

I tried the sample script in the helpfile but that gives me an error. I will further research, but thanks anyway!

Are you saying you tried my code along with a script from the help file and it didn't work? I just tested it with a few of my scripts and it worked fine.

Link to comment
Share on other sites

#Include <Date.au3>

While 1

$Time = _NowTime(4)

If $Time == "hh:mm" Then;change hh:mm to whatever time you want it to run

ExitLoop

Else

Sleep(500);you can make this longer if you don't need it to be exact

EndIf

WEnd

;Whatever function you want to run here

Are 2 equal signs there on purpose? Maybe thats the error

Link to comment
Share on other sites

Are 2 equal signs there on purpose? Maybe thats the error

from the help file under Operators:

== Tests if two values are equal (case sensitive if used with strings)

edit:

= Tests if two values are equal (case insensitive if used with strings).

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Several ways to accomplish this...

- Use one of the inbuilt macros to ascertain the time and go from there (@Hour etc). This requires script to be running all the time.

- Use Windows Scheduler to launch a script at a predetermined time.

Sometimes I get a one track mind. Plus I haven't used Windows Scheduler in a few years, so I totally forgot it.

Thanks

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