Page 1 of 1

Check, if task is running

Posted: Thu Feb 12, 2015 4:19 pm
by userXXX
Hello Oleg,

what would be the easiest way to check if a task is running?
Do I have to loop through all tasks like that...

cnt = RoboTaskApp.TaskCount
For i = 0 To cnt - 1
extNam = RoboTaskApp.TaskInfoExtName(i)
Next


...until I find the external task name searching for, get the TaskNum (variable i) and then use TaskInfoState?

Thank you.

Re: Check, if task is running

Posted: Wed Feb 18, 2015 3:02 pm
by Oleg
See the example of VB script

Code: Select all

num = RoboTaskApp.TaskNumByExternalName("MyTestTask")
if num >= 0 then
  st = RoboTaskApp.TaskInfoState(num)
  LogMessage(cstr(st))
else
  LogMessage("No such task!!!")
end if
See all methods and properties of RoboTaskApp object here: http://www.robotask.com/help/index.php? ... object.htm

Re: Check, if task is running

Posted: Wed Feb 18, 2015 7:57 pm
by Oleg
The same example on JavaScript

Code: Select all

num = RoboTaskApp().TaskNumByExternalName("MyTestTask");
if (num >= 0)
  {
  st = RoboTaskApp().TaskInfoState(num);
  LogMessage(st);
  }
else
  {
  LogMessage("No such task!!!");
  }