Storing and comparing variables

Discuss RoboTask here

Storing and comparing variables

Postby crisp212 » Wed Jun 20, 2018 1:03 am

Good night Oleg.

One question: I got this task that checks a website every 1 hour (Makes a f5 and then makes a ctrl+a and then ctrl+c). It stores all values of website (get text), copy its in a txt file (create txt file) and then stores line 51 where my interested value is (TXT Extract Line). The value is stored in variable named "true"

So what I want, is that every hour, after line 51 stored in variable "true", doesn't get overwritten by previous (so it creates first true1, true2, etc...)

Then, I want to be able to minus true1 and true2 and store it in another variable.

Can you help me? Thank you.

Regards,


Crisp212
crisp212
 
Posts: 21
Joined: Mon Dec 04, 2017 7:12 pm

Re: Storing and comparing variables

Postby Oleg » Thu Jun 21, 2018 4:03 pm

Maybe you need something like this (see my example)
This task saves 4 previous values of variable. You have to use global variables (menu Options->Variables and open Global User Variables tab)
To get it work make four global variables VAR1, VAR2, VAR3 and VAR4 with some initial value (for example 0)
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1040932817
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task501"
Hide=INTEGER|0
ID=INTEGER|1048493595
LogOnAsUser=INTEGER|1
Name=STRING|"save several values"
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
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Old Values"""
Params=FOLDER

[Actions\Action1\Params]
icon=STRING|"1"
msg0=STRING|"Old Values"
msg2=STRING|"var1 = {var1}"
msg3=STRING|"var2 = {var2}"
msg4=STRING|"var3 = {var3}"
msg5=STRING|"var4 = {var4}"
msgcount=STRING|"6"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""VAR4"" with value ""{var3}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"VAR4"
varvalue=STRING|"{var3}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""VAR3"" with value ""{var2}"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"VAR3"
varvalue=STRING|"{var2}"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""VAR2"" with value ""{var1}"""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"VAR2"
varvalue=STRING|"{var1}"

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

[Actions\Action5\Params]
default=STRING|"0"
password=STRING|"0"
prompt=STRING|"Input new value for VAR1"
variable=STRING|"VAR1"

[Actions\Action6]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""New Values"""
Params=FOLDER

[Actions\Action6\Params]
icon=STRING|"1"
msg0=STRING|"New Values"
msg2=STRING|"var1 = {var1}"
msg3=STRING|"var2 = {var2}"
msg4=STRING|"var3 = {var3}"
msg5=STRING|"var4 = {var4}"
msgcount=STRING|"6"
playsound=STRING|"0"
showmessage=STRING|"1"


To make necessary calculations use VB Evaluate or JS Evaluate actions
Oleg Yershov
Oleg
Site Admin
 
Posts: 2311
Joined: Thu Jan 01, 1970 1:00 am

Re: Storing and comparing variables

Postby crisp212 » Thu Jun 21, 2018 11:37 pm

Hi Oleg. I'll try. Thanks!
crisp212
 
Posts: 21
Joined: Mon Dec 04, 2017 7:12 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests