I am programming in vbscript of RoboTask.
I need to run multiple tasks in RoboTask, one after the previous one. I generated a random list to perform each task.
I developed a function called Randoms_Number(10) ---> output [3,5,1,7,6,10,2,4,9,8], which means it will run the task 3 and task 5 will run after , etc.
This is inside a while loop that will run until all tasks are executed, then the cycle ends and generates a new list and start again with the execution of each task.
However, before executing a next task, I need to know if the previous task is no longer running.
I think RoboTaskApp.TaskInfo2 (ByVal NumTask as Long, folderid as Long, State as TaskState) can help me, but not how to get the output result returned by this function.
Have any function or some other way to let me know if a task is still running?
Anyone help me please?
Know if task is running? (vbscript)
Know if task is running? (vbscript)
See the example of BASIC script below
It runs the task with external name "mainrask1" and waits for its finish
It runs the task with external name "mainrask1" and waits for its finish
Code: Select all
Sub Main
Dim num As Long
Dim fid As Long
Dim st As TaskState
RoboTaskApp.StartTask("maintask1","parameter=abc")
num = RoboTaskApp.TaskNumByExternalName("maintask1")
If num >= 0 Then
st = tsRunning
while st = tsRunning
Wait 0.5
RoboTaskApp.TaskIn fo2( num, fid, st)
Wend
MsgBox("Task finished")
End If
End Sub
Last edited by Oleg on Wed Feb 15, 2012 10:17 am, edited 1 time in total.
Know if task is running? (vbscript)
Ok!, Thanks... I will test the code!...