Numbers with dots in variables in an expression

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ppan
Posts: 2
Joined: 23 Oct 2017, 07:04

Numbers with dots in variables in an expression

23 Oct 2017, 07:12

I would like to use numbers with dots in an expression. Much to my surprise AHK actually does what I need it to do:

Code: Select all

if (12.34 < 23.45)
really works. However, the next step is to do this test with user input. So I'm using variables:

Code: Select all

Gui, Add, Edit, x200 y20 w250 h20 foo, 
Gui, Add, Edit, x200 y40 w250 h20 bar, 

if (%foo% < %bar%) 
I get an error that the variable contains an illegal character. I have tried "%foo%" and (%foo%) but both don't work. Does anyone have an idea?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Numbers with dots in variables in an expression

23 Oct 2017, 07:25

Hello and welcome. Please see expressions and operators in expressions, specifically %var%. Also see if (expression) and compare to if (traditional).
Try,

Code: Select all

if (foo < bar)
Good luck, cheers.
ppan
Posts: 2
Joined: 23 Oct 2017, 07:04

Re: Numbers with dots in variables in an expression

23 Oct 2017, 07:41

Oh seriously...I've been looking for half an hour but the answer has been there all that time! Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: DataLife, pgeugene, Rohwedder and 119 guests