Use local variables as integer and not as a string

Discuss RoboTask here

Use local variables as integer and not as a string

Postby MrWorf » Fri Apr 13, 2018 3:43 pm

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
MrWorf
 
Posts: 1
Joined: Fri Apr 13, 2018 3:29 pm

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

Postby Oleg » Fri Apr 13, 2018 9:37 pm

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


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests