Jump to content
Sign in to follow this  
Qual-IT London

scheduled task

Recommended Posts

Qual-IT London

can AutoIT create scheduled tasks?

i.e. create a .job file?

Share this post

Link to post
Share on other sites

Share this post

Link to post
Share on other sites

I don't think it can be done natively(without XP Pro). However, there is a program that can be run in the background that will schedule various tasks.


I'm also working on another scheduler.

If you have XP Pro, you can use schtasks.exe

Edited by MikelSevrel

Coming soon....

Share this post

Link to post
Share on other sites
Qual-IT London

I do indeed know about AT but hoped there was a nice function within AutoIT to add scheduled tasks with nice names and icons, instead of the AT command adding ID1 ID2 etc...

However, I have thought this over, and this piece of code works pretty well actually, only problem is you cannot "name" the scheduled task so if you run it several times you get several instances of the task.

I'll think on that one today. For anyone else in my situation maybe this will be of some help.

#include <GUIConstants.au3>

#Include <GuiCombo.au3>


Dim $hours

Dim $minutes

$tasks=GUICreate("Q-Backup" & " Scheduling your backup.",320,200)

$filemenu = GuiCtrlCreateMenu ("File")

$saveitem = GuiCtrlCreateMenuitem ("Set Schedule",$filemenu)

$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

GUICtrlCreateLabel ("Please select the time for Q-Backup to begin (24 hr format)", 5,10)

GUICtrlCreateLabel (":", 153,30)

$hours = GuiCtrlCreateCombo("", 100, 30, 50, 10)

$minutes = GuiCtrlCreateCombo("", 160, 30, 50, 10)

GUICtrlCreateLabel ("Please select the days of the week to run Q-Backup", 5,70)

$m = GUICtrlCreateCheckBox ("Monday", 5, 90)

$tu = GUICtrlCreateCheckBox ("Tuesday", 70, 90)

$w = GUICtrlCreateCheckBox ("Wednesday", 140, 90)

$t = GUICtrlCreateCheckBox ("Thursday", 225, 90)

$f = GUICtrlCreateCheckBox ("Friday", 5, 110)

$s = GUICtrlCreateCheckBox ("Saturday", 70, 110)

$su = GUICtrlCreateCheckBox ("Sunday", 140, 110)

$set = GuiCtrlCreateButton ("Set schedule",105,150,100,20)


For $i = 0 to 23

$len = StringLen($i)

if $len = 1 Then $i = 0&$i



For $i = 0 to 59

$len = StringLen($i)

if $len = 1 Then $i = 0&$i





GUICtrlSetState($m, $GUI_CHECKED)

GUICtrlSetState($tu, $GUI_CHECKED)

GUICtrlSetState($w, $GUI_CHECKED)

GUICtrlSetState($t, $GUI_CHECKED)

GUICtrlSetState($f, $GUI_CHECKED)

While 1

$msg = GUIGetMsg()


Case $msg = $GUI_EVENT_CLOSE


Case $msg = $set

Call ("save")

Case $msg = $saveitem

Call ("save")

Case $msg = $exititem






Func save()








If BitAND(GUICtrlRead($m), $GUI_CHECKED) = $GUI_CHECKED Then $monday = "m,"

If BitAND(GUICtrlRead($tu), $GUI_CHECKED) = $GUI_CHECKED Then $tuesday = "t,"

If BitAND(GUICtrlRead($w), $GUI_CHECKED) = $GUI_CHECKED Then $wednesday = "w,"

If BitAND(GUICtrlRead($t), $GUI_CHECKED) = $GUI_CHECKED Then $thursday = "t,"

If BitAND(GUICtrlRead($f), $GUI_CHECKED) = $GUI_CHECKED Then $friday = "f,"

If BitAND(GUICtrlRead($s), $GUI_CHECKED) = $GUI_CHECKED Then $saturday = "s,"

If BitAND(GUICtrlRead($su), $GUI_CHECKED) = $GUI_CHECKED Then $sunday = "su,"

$choicehours = GUICtrlRead ( $hours )

$choiceminutes = GUICtrlRead ( $minutes )

$atdays = $monday&$tuesday&$wednesday&$thursday&$friday&$saturday&$sunday

msgbox(0,"Run","at " & $choicehours & ":" & $choiceminutes & " /interactive" & " /every:" & $atdays & " " & chr(34) & "yourjob.exe" & chr(34) )


Share this post

Link to post
Share on other sites

Could you not check for job files before creating the task..

Find all files in Task folder. Create the new task then find all the files in the task folder again, at this point you can find out what your new task is called which is going to be At???? then just rename it with AutoIT to QSchedTask or whatever you want to call it that way you'll know if you've already set the task up.

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
Sign in to follow this