Discuss RoboTask here
jan
Posts: 28 Joined: Wed Jan 22, 2025 4:36 pm
Post
by jan » Sun Jan 26, 2025 1:17 pm
Hello everyone,
I would like to check cyclically whether a certain program "A" is running. If it is not running, a certain program "B" should be closed if it is running and "A" should be started automatically. My code does not seem to work:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1"
Hide=INTEGER|0
ID=INTEGER|-1927680902
LogOnAsUser=INTEGER|1
Name=STRING|"Ensure ""Automatic Email Processor"" is running"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
[Actions\Action1]
ActionID=STRING|"A_MISC_WAITPROCESSSTART"
Enabled=INTEGER|-1
Name=STRING|"Wait for process ""C:\Program Files (x86)\Automatic Email Processor\AutomaticEmailProcessor.exe"" start (1 sec)"
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"AEP"
infinity=STRING|"0"
process=STRING|"C:\Program Files (x86)\Automatic Email Processor\AutomaticEmailProcessor.exe"
timeout=STRING|"1"
waitresult=STRING|"1"
waitresultvar=STRING|"AEP"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{AEP}"
value2=STRING|"0"
[Actions\Action3]
ActionID=STRING|"A_MISC_KILLAPP"
Enabled=INTEGER|-1
Name=STRING|"Terminate process ""C:\Program Files (x86)\Automatic Email Processor\AEPProcessor.exe"""
Params=FOLDER
[Actions\Action3\Params]
more=STRING|"2"
process=STRING|"C:\Program Files (x86)\Automatic Email Processor\AEPProcessor.exe"
[Actions\Action4]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 10 sec"
Params=FOLDER
[Actions\Action4\Params]
delay=STRING|"10"
dimension=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""AutomaticEmailProcessor.exe """
Params=FOLDER
[Actions\Action5\Params]
ifnonzero=STRING|"0"
program=STRING|"C:\Program Files (x86)\Automatic Email Processor\AutomaticEmailProcessor.exe"
runas=STRING|"2"
wait=STRING|"0"
[Actions\Action6]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Events]
Event1=FOLDER
[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Name=STRING|"Cyclic (every 600 sec)"
Params=FOLDER
UniqueID=INTEGER|1994471606
[Events\Event1\Params]
interval=STRING|"600"
notsatrtatactivation=STRING|"0"
Oleg
Site Admin
Posts: 3181 Joined: Thu Jan 01, 1970 1:00 am
Contact:
Post
by Oleg » Sun Jan 26, 2025 2:02 pm
Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Do not forget to enable the task after importing.
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
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1562"
Hide=INTEGER|0
ID=INTEGER|-1972044874
LogOnAsUser=INTEGER|1
Name=STRING|"Ensure ""Automatic Email Processor"" is running (version 2)"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""programA"" with value ""C:\Program Files (x86)\Automatic Email Processor\AutomaticEmailProcessor.exe"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"programA"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"programA"
varvalue=STRING|"C:\Program Files (x86)\Automatic Email Processor\AutomaticEmailProcessor.exe"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action11]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 10 sec"
Params=FOLDER
[Actions\Action11\Params]
delay=STRING|"10"
dimension=STRING|"1"
[Actions\Action12]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""{programA} """
Params=FOLDER
[Actions\Action12\Params]
ifnonzero=STRING|"0"
program=STRING|"{programA}"
runas=STRING|"0"
wait=STRING|"0"
[Actions\Action13]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""programB"" with value ""C:\Program Files (x86)\Automatic Email Processor\AEPProcessor.exe"""
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"programB"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"programB"
varvalue=STRING|"C:\Program Files (x86)\Automatic Email Processor\AEPProcessor.exe"
[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then //if programA is running"
Params=FOLDER
[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsProcessExists({programA})}"
[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then // if programB is not running"
Params=FOLDER
[Actions\Action4\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{IsProcessExists({programB})}"
[Actions\Action5]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""{programB} """
Params=FOLDER
[Actions\Action5\Params]
ifnonzero=STRING|"0"
program=STRING|"{programB}"
runas=STRING|"0"
wait=STRING|"0"
[Actions\Action6]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action7]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then // if programB is running"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsProcessExists({programB})}"
[Actions\Action9]
ActionID=STRING|"A_MISC_KILLAPP"
Enabled=INTEGER|-1
Name=STRING|"Terminate process ""{programB}"""
Params=FOLDER
[Actions\Action9\Params]
more=STRING|"2"
process=STRING|"{programB}"
[Events]
Event1=FOLDER
[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Name=STRING|"Cyclic (every 600 sec)"
Params=FOLDER
UniqueID=INTEGER|1442990722
[Events\Event1\Params]
interval=STRING|"600"
notsatrtatactivation=STRING|"0"
Oleg Yershov
jan
Posts: 28 Joined: Wed Jan 22, 2025 4:36 pm
Post
by jan » Sun Jan 26, 2025 6:13 pm
Oleg, many thanks for the quick help. It works great.
Best regards, Ján
P.S. Can you please help me with my other problem too, where I want to write numbers in a Word document and then print a PDF?
Best regards from Munich