List of all Scheduled Tasks

Discuss RoboTask here
Post Reply
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

List of all Scheduled Tasks

Post by waldo »

Oleg,
I have many, many task folders with a good number of scheduled tasks (90+). I am running into issues where two separate scheduled tasks are over lapping. For example, a task starts at 4:30 and this task is in one RoboTask task folder and I create another task thinking 4:30 is a good time to schedule a new task from another task folder. In many instances, my scheduled tasks are interacting with a program via simulated key presses and when two of these tasks end-up running simultaneously its a disaster. Is there any way I can secure a report of ALL scheduled robotask tasks across all Robotask task folders? This information would greatly help me identify where I have scheduled tasks that use simulated key strokes scheduled too close together across the multiple task folders. Thank you for all of your help. JimC
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: List of all Scheduled Tasks

Post by Oleg »

look at this task

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task190"
Hide=INTEGER|0
ID=INTEGER|1521844374
LogOnAsUser=INTEGER|1
Name=STRING|"Get all scheduled tasks"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER

[Actions\Action1]
ActionID=STRING|"A_SCRIPT_VBSCRIPT"
Enabled=INTEGER|-1
Name=STRING|"VB Script"
Params=FOLDER

[Actions\Action1\Params]
expandvars=STRING|"0"
line00000000=STRING|"function HasScheduler(TaskNum)"
line00000001=STRING|"  dim i"
line00000002=STRING|"  dim num"
line00000003=STRING|"  HasScheduler = false"
line00000004=STRING|"  num = RoboTaskApp.EventsCount(TaskNum)"
line00000005=STRING|"  for i=0 to num - 1  step 1"
line00000006=STRING|"    TriggerKind = RoboTaskApp.EventInfoEventID(TaskNum, i)"
line00000007=STRING|"    if TriggerKind = ""E_GENERAL_SHEDULER"" then"
line00000008=STRING|"      HasScheduler = true"
line00000009=STRING|"      exit function"
line0000000A=STRING|"    end if"
line0000000B=STRING|"  next"
line0000000C=STRING|"end Function"
line0000000E=STRING|"cnt = 1"
line0000000F=STRING|"num = RoboTaskApp.TaskCount"
line00000010=STRING|"for i=0 to num -1 step 1"
line00000011=STRING|"  if HasScheduler(i) then"
line00000012=STRING|"    state = RoboTaskApp.TaskinfoState(i)"
line00000013=STRING|"    msg = cstr(cnt) + "" "" + RoboTaskApp.TaskInfoName(i)"
line00000014=STRING|"    if state = 0 then"
line00000015=STRING|"      msg = msg + "" (disabled)"""
line00000016=STRING|"    end if"
line00000017=STRING|"    LogMessage(msg)"
line00000018=STRING|"    cnt = cnt + 1"
line00000019=STRING|"  end if"
line0000001A=STRING|"next"
linecount=STRING|"27"
savescript=STRING|"0"
The task enumerates all tasks which contain Scheduler trigger.
If the task is disabled then script add "(disabled)" string to the end of the line
Oleg Yershov
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

Re: List of all Scheduled Tasks

Post by waldo »

Oleg, thank you. Any chance the output can provide the scheduled time? JimC
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: List of all Scheduled Tasks

Post by Oleg »

Unfortunately there is no mechanism to retrieve next scheduling time from a trigger.
Calculation algorithm is very complex.
But if you know the scheduling time this can't guarantee that the tasks will not overlapping. I will not go into details, but it is true.

One advise:
If you know tasks which can conflict with each other you can prohibit the simultaneous work.

for example: Task1 conflicts with Task2
Put into beginning of the task such steps (for task1):

Code: Select all

Task status (task2)
If status = 3 then
   exit
end if 
....
other steps
In the Task2 the similar code, but check the status for Task1
In other words you have to check task status of other task and if it is running now - stop working.

Also look at the action Wait for task
But use it very carefully. If Task1 will wait Task2 and Task2 will wait Task1 with infinity timeout you easily can obtain deadlock (read this about deadlock).
Tasks will not work and it will not end until you kill the task
Oleg Yershov
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

Re: List of all Scheduled Tasks

Post by waldo »

Oleg, thanks for the advice. I have about 150 task spread across 6 RoboTask folders. Most, not all, of these tasks initiate key strokes to interact with database software. Over time as our database has grown larger, the response time has slowed. At times, I added the Pause command to individual tasks to account for the slower response time. But what has now happened is that I have tasks firing when one task is still running because when I added "Pause" time it eventually caused the initial task to run so long that when an unrelated task fires from another folder the screen is still open with the database software receiving the key strokes. I may just have to go task by task to correct the problem. I guess that's what happens in 5 years of creating more and more tasks sending keystrokes to a data base program with a slower response rate given the increase in database size. Thank you. JIm
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

Re: List of all Scheduled Tasks

Post by waldo »

Oleg,
Will the VB script work in Version 5.6.7.823? The VB script worked on the latest RoboTask version on a Win10 PC but the old version is on a Win7. If I update version 5.6.823 to the latest version, are all of my current tasks retained? Are all scheduled tasks---still scheduled after the update? Is there any risk in updating a very active, old version of RoboTask to the latest version? I have put off updating the old version for fear of corrupting tasks or scheduled tasks are no longer scheduled after the update. Thank you. Jim
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: List of all Scheduled Tasks

Post by Oleg »

Unfortunately version 5.6 doesn't contain Scripting Tools plugin
Scripting tools plugin was implemented since version 6.2. VB script actions since version 6.3

But you can use Basic script action for this.
Just download additional Basic plugin for RoboTask. You can find it here: https://robotask.com/download/oldversions/ Open folder "v.5.6.7"
>>or use this direct link <<
Basic plugin is deprecated and we will remove it from future versions. But it work very well in previous versions of RoboTask and previous versions of Windows™

The script will be similar but it contains some changes. Use the task below.
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task216"
Hide=INTEGER|0
ID=INTEGER|858051742
LogOnAsUser=INTEGER|1
Name=STRING|"Get all scheduled tasks (with basic plugin)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER

[Actions\Action1]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Internal basic script"
Params=FOLDER

[Actions\Action1\Params]
line00000=STRING|"Function HasScheduler(TaskNum)"
line00001=STRING|"  Dim i"
line00002=STRING|"  Dim num"
line00003=STRING|"  HasScheduler = False"
line00004=STRING|"  num = RoboTaskApp.EventsCount(TaskNum)"
line00005=STRING|"  For i=0 To num - 1  Step 1"
line00006=STRING|"    TriggerKind = RoboTaskApp.EventInfoEventID(TaskNum, i)"
line00007=STRING|"    If TriggerKind = ""E_GENERAL_SHEDULER"" Then"
line00008=STRING|"      HasScheduler = True"
line00009=STRING|"      Exit Function"
line00010=STRING|"    End If"
line00011=STRING|"  Next"
line00012=STRING|"End Function"
line00014=STRING|"Sub Main"
line00015=STRING|"	cnt = 1"
line00016=STRING|"	num = RoboTaskApp.TaskCount"
line00017=STRING|"	For i=0 To num -1 Step 1"
line00018=STRING|"	  If HasScheduler(i) Then"
line00019=STRING|"	    state = RoboTaskApp.TaskInfoState(i)"
line00020=STRING|"	    msg = CStr(cnt) + "" "" + RoboTaskApp.TaskInfoName(i)"
line00021=STRING|"	    If state = 0 Then"
line00022=STRING|"	      msg = msg + "" (disabled)"""
line00023=STRING|"	    End If"
line00024=STRING|"	   ' LogMessage(msg)"
line00025=STRING|"	   Debug.Print msg"
line00026=STRING|"	    cnt = cnt + 1"
line00027=STRING|"	  End If"
line00028=STRING|"	Next"
line00029=STRING|"End Sub"
linecount=STRING|"30"
source=STRING|"0"

Oleg Yershov
Post Reply