Why "10Z" is smaller then "4Z" in autoit???

Recommended Posts

Hello,

User can input 2 values between 2Z and 14Z in 2 input box.

I need to display this 2 values in a 3rd box BUT the value should be "the biggest number + the smallest number".

So if user inputs 5Z and 10Z, i need to show in 3rd box: 10Z5Z

If user inputs 14Z and 8Z, i need to show in 3rd box: 14Z8Z.

I tried the folowing code but is not working ok, is says that 10Z is smaller then 4Z. Why? How can I correct this?

"Z" can be replaced with anything, but it should be someting like a separator

```Global \$c1 = GUICtrlRead(\$cartea1) & "Z"
Global \$c2 = GUICtrlRead(\$cartea2) & "Z"

If \$c1 < \$c2 Then
Global \$ct = \$c2 & \$c1
msgbox (0, "dsda", \$c1)    %%%%%%%%%% if \$c1 = 10 and \$c2=2 then i get the msgbox "c1<c2" but this is not true!!
msgbox (0, "dsda", \$c2)
msgbox (0, "dsda", "c1<c2")
Endif

If \$c1 > \$c2 Then
\$ct = \$c2 & \$c1
msgbox (0, "dsda", "c1>c2")
Endif```

Share on other sites

because 4Z and 10Z is string.

```\$c1 =  Number(\$c1)
\$c2 = Number(\$c2)```

Regards,

Thank you

Share on other sites

You may also first compare the GUICtrlRead(...) which are numeric, then add the Z's where needed

Share on other sites

yeah you are right, but I resolved using "Number (variable)"

Thanks!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account