Page 1 of 1

Start Task from Batch and Assign Value to Variable

Posted: Mon Jan 21, 2019 6:30 pm
by jrunkel
Hi there,

thanks for the wonderful software!

We build a nice task with several actions and use 2 local variables in it. Now we created a batch file to run that task (menu "Create Batch File"). How can we specify the value of the variables in the batch file? We need this because the values of the variables must be changable without user interaction.

We tried:

Code: Select all

.../RoboTask.exe $TASKID123 MyVar1=Value MyVar2=Else
but without success.

Please help!

jrunkel

Re: Start Task from Batch and Assign Value to Variable

Posted: Tue Jan 22, 2019 2:47 pm
by Oleg
You can't start the task with parameters from batch file right now.
I wrote this into our ToDo.

But now you can write some file in the batch file and run the task.
The task should read this file and use this data. Lets 1-st lite is the 1-st parameter, 2-nd line - second parameter and so on

Look at my example below
The 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|"Task54"
Hide=INTEGER|0
ID=INTEGER|-984000395
LogOnAsUser=INTEGER|1
Name=STRING|"Run task with from batch file"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line (param1)"
Params=FOLDER

[Actions\Action1\Params]
external=STRING|"1"
filename=STRING|"{TempDir}\param.txt"
linecount=STRING|"0"
linenum=STRING|"1"
variable=STRING|"param1"

[Actions\Action2]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line (param2)"
Params=FOLDER

[Actions\Action2\Params]
external=STRING|"1"
filename=STRING|"{TempDir}\param.txt"
linecount=STRING|"0"
linenum=STRING|"2"
variable=STRING|"param2"

[Actions\Action3]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line (Param3)"
Params=FOLDER

[Actions\Action3\Params]
external=STRING|"1"
filename=STRING|"{TempDir}\param.txt"
linecount=STRING|"0"
linenum=STRING|"3"
variable=STRING|"param3"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Param1 = {param1}"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Param1 = {param1}"
msg1=STRING|"Param2 = {param2}"
msg2=STRING|"Param3 = {param3}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Do not forget to enable the task after importing.

The batch file to run it

Code: Select all

echo This parameter1 > %temp%\param.txt
echo parameter2 - just some string>> %temp%\param.txt
echo Hello world!!! >> %temp%\param.txt

"C:\Program Files (x86)\RoboTask\RTaskRun.exe" -984000395
To change parameters you need to change BAT or CMD file only

Re: Start Task from Batch and Assign Value to Variable

Posted: Tue Dec 15, 2020 9:47 pm
by juanlu
Oleg wrote:You can't start the task with parameters from batch file right now.
I wrote this into our ToDo.
Is this already available in the latest release?
If not, is there an estimated timeline?

Re: Start Task from Batch and Assign Value to Variable

Posted: Wed Dec 16, 2020 10:52 am
by Oleg
Is this already available in the latest release?
No, sorry.