In order to run the task with parameters use the expression
Code: Select all
rt.start_task('TestParam', 'p1=Hello\np2=World\np3=Simple String')
This code starts the task with external name
TestParam and pass 3 parameters: p1, p2, and p3
Look full examples below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
1-st task which receives parameters. The tasks has external name
TestParam
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"TestParam"
Hide=INTEGER|0
ID=INTEGER|1773267551
LogOnAsUser=INTEGER|1
Name=STRING|"Show parameters"
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_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""param1 = {p1}"""
Params=FOLDER
[Actions\Action1\Params]
icon=STRING|"1"
msg0=STRING|"param1 = {p1}"
msg1=STRING|"param2 = {p2}"
msg2=STRING|"param2 = {p3}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
2-nd task. It launches 1-st task with 3 parameters in python script
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task38"
Hide=INTEGER|0
ID=INTEGER|-1377614384
LogOnAsUser=INTEGER|1
Name=STRING|"Python Script (run task with parameters)"
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_PYTHONSCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Python Script"
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
script_0=STRING|"from robotask import *"
script_1=STRING|"rt = RoboTask()"
script_2=STRING|"rt.start_task('TestParam', 'p1=Hello\np2=World\np3=Simple String')"
script_count=STRING|"3"
script_type=STRING|"0"
search_paths_count=STRING|"0"
use_embedded=STRING|"1"