Use local variables as integer and not as a string

Discuss RoboTask here
Post Reply
MrWorf
Posts: 1
Joined: Fri Apr 13, 2018 3:29 pm

Use local variables as integer and not as a string

Post by MrWorf »

I am newbie, so I hope you understand :)

I use the task editor to declare 2 local variables
WIDTH=0
HEIGHT=0
Then I use Window Get Size and Position to get the width and the height of the active window and store these values in the variables
That's working
Then I use Window Size and Position to place the active Window
To keep it simple I want to change the position of the Window, let's say:
X: {ScreenW(0)}-{WIDTH}
Y: {HEIGHT}

The X value is not accepted:
The value "1920-427" is not an integer value. XPos has been reset to default value (0)
What am I doing wrong?
Thanks in advance for your support and have a nice day
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Use local variables as integer and not as a string

Post by Oleg »

All variables in RoboTask are strings.
When you use variables in some expressions RoboTask make substitution only. It replace the variable with its value.

If you want to calculate some mathematics expression you have to use evaluation actions: JS Evaluate or VB Evaluate
You can use arithmetic operators or some language functions. Also you can write your own function to calculate value by your algorithm.
Oleg Yershov
Post Reply