Check, if task is running

Discuss RoboTask here
Post Reply
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Check, if task is running

Post 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.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Check, if task is running

Post 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
Oleg Yershov
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Check, if task is running

Post 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!!!");
  }
Oleg Yershov
Post Reply