Basic Plugin

Discuss RoboTask here
Post Reply
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Basic Plugin

Post by steph@vds »

Hi,

I've discovered your new Plug-in "Basic Script".
It seems very interesting but a little complex for me.
I know that you can't explain to everybody the Basic Script Language
but is it possible to get a simple example of Basic Script just to make
simple operations (addition, substraction etc.)
I tried to do this in the following task but I don't know how to show the result of my operation in Robotask.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1572434964
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task94"
Hide=INTEGER|0
ID=INTEGER|1243614119
Name=STRING|"CALCUL TEST 1"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_A"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_A"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_B"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_B"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action3\Params]
default=STRING|"0"
prompt=STRING|"Quelle est la durée du film ? (en min)"
variable=STRING|"PARAMETER_A"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action4\Params]
default=STRING|"0"
prompt=STRING|"Quel sera le débit ? (en kbits/sec)"
variable=STRING|"PARAMETER_B"

[Actions\Action5]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Basic Script"
Params=FOLDER

[Actions\Action5\Params]
line00000=STRING|"Sub Main"
line00001=STRING|"    Dim a As Double"
line00002=STRING|"    Dim b As Double"
line00004=STRING|"    a = Val (RoboTaskApp.ExpandText(""{Parameter_a}""))"
line00005=STRING|"    b = Val (RoboTaskApp.ExpandText(""{Parameter_b}""))"
line00007=STRING|"    d = (b+192)*a*60*1.013/1000/1000/8"
line00009=STRING|"End Sub"
linecount=STRING|"10"
source=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""PARAMETER_A"""
Params=FOLDER

[Actions\Action6\Params]
varname=STRING|"PARAMETER_A"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""PARAMETER_B"""
Params=FOLDER

[Actions\Action7\Params]
varname=STRING|"PARAMETER_B"



Thanx
Steph@vds
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Basic Plugin

Post by Oleg »

No problem. Use RoboTaskApp.SetUserVariable method. Also, you can use BASIC procedure MsgBox (refer to BASIC help).
See task below.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task389"
Hide=INTEGER|0
ID=INTEGER|1243614119
Name=STRING|"CALCUL TEST 1"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_A"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_A"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_B"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_B"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action3\Params]
default=STRING|"0"
prompt=STRING|"Quelle est la durée du film ? (en min)"
variable=STRING|"PARAMETER_A"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action4\Params]
default=STRING|"0"
prompt=STRING|"Quel sera le débit ? (en kbits/sec)"
variable=STRING|"PARAMETER_B"

[Actions\Action5]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Basic Script"
Params=FOLDER

[Actions\Action5\Params]
line00000=STRING|"Sub Main"
line00001=STRING|"    Dim a As Double"
line00002=STRING|"    Dim b As Double"
line00004=STRING|"    a = Val (RoboTaskApp.ExpandText(""{Parameter_a}""))"
line00005=STRING|"    b = Val (RoboTaskApp.ExpandText(""{Parameter_b}""))"
line00007=STRING|"    d = (b+192)*a*60*1.013/1000/1000/8"
line00009=STRING|"    RoboTaskApp.SetUse rVariable(""Result"",Str(d))"
line00011=STRING|"End Sub"
linecount=STRING|"12"
source=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""result is {result}"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"result is {result}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""PARAMETER_A"""
Params=FOLDER

[Actions\Action7\Params]
varname=STRING|"PARAMETER_A"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""PARAMETER_B"""
Params=FOLDER

[Actions\Action8\Params]
varname=STRING|"PARAMETER_B"
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Basic Plugin

Post by Oleg »

For simple calculations you can use Evaluate action.
But I advise you to use brackets "()" in expression.
See task below:

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task390"
Hide=INTEGER|0
ID=INTEGER|1148674652
Name=STRING|"CALCUL TEST 2"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_A"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_A"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""PARAMETER_B"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"PARAMETER_B"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action3\Params]
default=STRING|"0"
prompt=STRING|"Quelle est la durée du film ? (en min)"
variable=STRING|"PARAMETER_A"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action4\Params]
default=STRING|"0"
prompt=STRING|"Quel sera le débit ? (en kbits/sec)"
variable=STRING|"PARAMETER_B"

[Actions\Action5]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER

[Actions\Action5\Params]
expression=STRING|"({Parameter_b}+192)*(({parameter_a}*60)*1 .013)/1000/1000/8"
variable=STRING|"RESULT"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""result is {result}"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"result is {result}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|1
Name=STRING|"Remove variable ""PARAMETER_A"""
Params=FOLDER

[Actions\Action7\Params]
varname=STRING|"PARAMETER_A"

[Actions\Action8]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|1
Name=STRING|"Remove variable ""PARAMETER_B"""
Params=FOLDER

[Actions\Action8\Params]
varname=STRING|"PARAMETER_B"

Last edited by Oleg on Thu Feb 16, 2006 7:43 am, edited 1 time in total.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Basic Plugin

Post by steph@vds »

Hi,

It's simply wonderful !

Thanks
Post Reply