Jump to content
u0000999

How to create schedule

Recommended Posts

u0000999

Hello. I've got my script and I  need to create schedule for this script: from 0.00 to 13.00 every 30 minutes activate my script. It should be activated at the end of the 30 min period -1 second. For instance 23.59.59, 00.30.59. 00.59.59, 1.29.59 and so on....

 

Regards, Oleg!

Share this post


Link to post
Share on other sites
aa2zz6

You can use task scheduler to do this

Share this post


Link to post
Share on other sites
TheXman

Have you thought about using a Windows Scheduled Task?

If you want pointers on how to do it using AutoIt, I would suggest posting your attempt at scripting it so that someone can help you understand why it didn't work and possibly help you get it working.

Share this post


Link to post
Share on other sites
hotkidd
On 4/29/2018 at 1:48 AM, aa2zz6 said:

You can use task scheduler to do this

Hi @aa2zz6, do you know why Win10 task scheduler doesnt work when I scheduled an AutoIT script in it? I posted another question with more details: 

 

Share this post


Link to post
Share on other sites
KickStarter15

@u0000999,

Maybe you can get some idea with this. This auto updater of mine will have to input time and date depending on when should I wanted it to run. However, it will exit the loop when it met the desired input time and once done processing the program. Hope you can start on this.:) But once you completed the first task, then you can loop back to the next task if you want.

Here's the hours, minutes and seconds:

$time = @HOUR&":"&@MIN&":"&@SEC

 

Here's the code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ColorConstants.au3>

$Form1 = GUICreate("Auto-Updating Tool", 369, 194, 500, 124)
GUISetBkColor(0xABB1B4)
$MonthCal1 = GUICtrlCreateMonthCal("", 8, 16, 229, 164)
$ButtonRun = GUICtrlCreateButton("Run", 256, 104, 97, 33)
$ButtonVld = GUICtrlCreateButton("Validate", 256, 35, 97, 33)
$ButtonClose = GUICtrlCreateButton("Close", 256, 144, 97, 33)
$InDate = GUICtrlCreateInput("",255, 15, 40, 20)
GUICtrlSetState($InDate, $GUI_Disable)
$timeHr = GUICtrlCreateInput("",295, 15, 30, 20)
$timeMin = GUICtrlCreateInput("",325, 15, 30, 20)
GUICtrlCreateLabel("Clendar", 100, 0, 38, 15)
GUICtrlCreateLabel("Date", 262, 0, 35, 15)
GUICtrlCreateLabel("Hr.", 305, 0, 35, 15)
GUICtrlCreateLabel("Min.", 332, 0, 35, 15)


GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $ButtonClose
            Exit
        Case $ButtonVld
            $Date = @YEAR & "/" & @MON & "/" & @MDAY
            MsgBox(64,"Information", "Date: " & GUICtrlRead($MonthCal1) & @CRLF & "Time: " & GUICtrlRead($timeHr) & ":" & GUICtrlRead($timeMin) & @CRLF & "User: " & @UserName)
            $Time = @HOUR&":"&@MIN&":"&@SEC
            MsgBox(64,"Time", $Date & " Time is: " & $Time)
            GUICtrlSetData($InDate, GUICtrlRead($MonthCal1))
            Call("ReturnVal")
        Case $ButtonRun
         If GUICtrlRead($timeHr) = "" Then
            MsgBox(64, "Warning:", "Warning: Input desired hour!")
            Call("ReturnVal")
         ElseIf GUICtrlRead($timeMin) = "" Then
            MsgBox(64, "Warning:", "Warning: Input desired minutes!")
            Call("ReturnVal")
         Else
         GUISetState(@SW_HIDE)
         While True
            Sleep(1000)
            $Date = @YEAR & "/" & @MON & "/" & @MDAY
            If $Date = GUICtrlRead($InDate) And GUICtrlRead($timeHr) = @HOUR And GUICtrlRead($timeMin) = @MIN Then
               RunWait("notepad.exe"); just a sample what program to run...
               DirCopy("D:\Programs\Autoit\", @ScriptDir & "\New Version", 1)
               GUIDelete($Form1)
               Call("Close")
               ExitLoop
            EndIf
            Sleep(1000)
         WEnd
         EndIf
    EndSwitch
WEnd
Func Close()
   Exit
EndFunc
Func ReturnVal()
   Return
EndFunc

 


Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

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

×