07-13-2011, 08:03 PM
I'm trying to schedule a task using RunConsole2 to launch schtasks with a command line to create a scheduled task that will run a QM function.
The problem is getting it to create the right "TaskRun".
It needs to be=
"c:\program files\quick macros 2\qmcl.exe" T MS "{tr}""
But get return error:
ERROR: Invalid Argument/Option - 'T'.
Type "SCHTASKS /CREATE /?" for usage.
Function ScheduleOnce
The problem is getting it to create the right "TaskRun".
It needs to be=
"c:\program files\quick macros 2\qmcl.exe" T MS "{tr}""
But get return error:
ERROR: Invalid Argument/Option - 'T'.
Type "SCHTASKS /CREATE /?" for usage.
Function ScheduleOnce
function int'mm str'tn str'tr
;EXAMPLE
;ScheduleOnce 1 "Test" "Function3"
;;Adds number of minutes from now to schedule task
DATE d.getclock
d=d+(6.9444444444444444444444444444444e-4*mm)
;;Deletes old task if couldn't run.
;;Create task will fail if task with same name exists
str Del=
F
;schtasks
;/Delete
;/TN {tn}
;/F
Del.findreplace("[]" " ")
Del.trim
RunConsole2(Del str'out1)
out out1
;;Defines time to run for command line formatting
str st.timeformat("{HH}:{mm}:{ss}" d)
str sd.timeformat("{MM}/{dd}/{yyyy}" d)
;;Formats schtasks command line
str cl=
F
;schtasks
;/create
;/tn {tn}
;/tr "c:\program files\quick macros 2\qmcl.exe" T MS "{tr}""
;/sc once
;/st {st}
;/sd {sd}
cl.findreplace("[]" " ")
cl.trim
RunConsole2(cl str'sout)
out sout