Start Task from Batch and Assign Value to Variable

Discuss RoboTask here

Start Task from Batch and Assign Value to Variable

Postby jrunkel » Mon Jan 21, 2019 6:30 pm

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
jrunkel
 
Posts: 1
Joined: Mon Jan 21, 2019 6:23 pm

Re: Start Task from Batch and Assign Value to Variable

Postby Oleg » Tue Jan 22, 2019 2:47 pm

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


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 14 guests