Page 1 of 1

How to use the Robotask?

Posted: Thu May 30, 2024 8:23 am
by lustrous
Hi, I'm a newbie.
My question is how can I use the Robotask variable at VBScript and give a result back to Robotask with a new Variable?
Thanks for any help.

Re: How to use the Robotask?

Posted: Fri May 31, 2024 10:17 am
by Oleg
Yes, of course, this is possible
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.

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
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task19"
Hide=INTEGER|0
ID=INTEGER|1073287407
LogOnAsUser=INTEGER|1
Name=STRING|"VB script with variables"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""VariableIN"" with value ""Hello world!!!"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"VariableIN"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"VariableIN"
varvalue=STRING|"Hello world!!!"

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

[Actions\Action2\Params]
expandvars=STRING|"0"
line00000000=STRING|"InVar = RoboTaskApp.expandtext(""{VariableIn}"")"
line00000001=STRING|"LogMessage(""InVar="" + InVar)"
line00000002=STRING|"OutVar = InVar + "" added some text in VBScript"""
line00000003=STRING|"LogMessage(""OutVar="" + OutVar)"
line00000004=STRING|"' set new variable in the task"
line00000005=STRING|"RoboTaskApp.SetUserVariable ""VariableOut"", OutVar"
linecount=STRING|"7"
savescript=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_SHOWTEXT"
Enabled=INTEGER|-1
Name=STRING|"Show Text"
Params=FOLDER

[Actions\Action3\Params]
autoclose=STRING|"0"
fromfile=STRING|"1"
line00000000=STRING|"input = {VariableIN}"
line00000001=STRING|"output = {VariableOUT}"
linecount=STRING|"2"
timeout=STRING|"10"
title=STRING|"Varables"
Read more about RoboTaskApp object here