Jump to content

How to run a program in arbitrary time within a certain period everyday?


Recommended Posts

Posted

Dear All,

Can any expert teach me how to write a script to run a Program.exe in any arbitrary time within a certain period everyday?

For example, I want to run a program (C:\Program.exe) in any time between 13:00-14:00 everyday. Today at 13:01, tomorrow at 13:33, day after tomorrow at 13:25, .

Please help!! Thanks in advance.

Posted (edited)

This is simple.

While 1
If _Time = "13:" & Random(00, 60, 1) & ":" & Random(00, 60, 1) And $Run <> -1 Then
     Run("Program.exe")
     $Run = -1
ElseIf @HOUR <> 13 Then
     $Run = 0
EndIf
Sleep(10)
WEnd
Func _Time()
     $Time = @HOUR & ":" & @MIN & ":" & @SEC
     Return $Time
Endfunc

If it is 1pm (or 13) at a Random Minute and Second then it will run B) Easy

Edited by AutoIt Smith

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