Jump to content

Simple If-Then


Idea
 Share

Recommended Posts

  • Developers

Q1:You have 3 times $[] in stead of $c[] ...

Q2: This $t = $c[1] & $c[2] & $c[3] & $c[4] creates a string becaue your concatenate the 4 values as strings.

PS your example in Q2 gives an error because you dim $a[4] which means $a[0] - $a[3]

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Q1:You have 3 times $[] in stead of $c[] ...

It is still not working:

If Number(IsNumber($c[1] + $c[2] + $c[3] + $c[4])) And _;2005 
($c[5] == "-") And _                  ;-
Number(IsNumber($c[6] + $c[7])) And _             ;09
($c[8] == "-") And _                  ;-
Number(IsNumber($c[9] + $c[10])) And _                ;19
($c[11] == "") And _                  ;
Number(IsNumber($c[12] + $c[13])) And _               ;08
($c[14] == ":") And _                 ;:
Number(IsNumber($c[15] + $c[16])) And _               ;57
($c[17] == ":") And _                 ;:
Number(IsNumber($c[18] + $c[19])) And _               ;43
($c[20] == "") And _                  ;
($c[21] == ":") And _                 ;:
($c[22] == "") And _                  ;
StringIsUpper( $c[23] & $c[24] ) And _      ;IN
($c[25] == "`") And _                 ;`
Number(IsNumber($c[26] + $c[27] + $c[28] + _;1234567
$c[29] + $c[30] + $c[31] + $c[32] + _
$c[33])) And _
($c[34] == "`") Then                   ;`
MsgBox(0, "ok!", "ok")
EndIf

Same error as before. ;)

Q2: This $t = $c[1]& $c[2] & $c[3] & $c[4] creates a string becaue your concatenate the 4 values as strings.

How do I concatenate as numbers then? Using + will add them literally 2 and 3 become 5 instead of 23 for example.

Thank you.

Edited by Idea
Link to comment
Share on other sites

create your numeric string the way you already are, then explicitly typecast it as a number with the Number() function

Thank you. I wrongly assumed I didn't have to preform typecasting in AutoIt.

I updated the code (see 2nd post) to include the typecasting and I get a new error now. Line 10 Error: "If" statements must have a "Then" keyword.

Well the Then keyword is there so I do not see why it is incorrect. Thanks for your time.

Edited by Idea
Link to comment
Share on other sites

Thank you. I wrongly assumed I didn't have to preform typecasting in AutoIt.

typically you don't since all variables are variants, but i believe that when you typecast a variable by concatenating it, or performing mathematical calculations on it, to use it any other way you have to re-cast it.
Link to comment
Share on other sites

  • Developers

Same error as before.

Maybe you can explain what you want to do with Number(IsNumber()) logic , because I don't understand ?

I do not get any AutoIt3 error when i runn this code...

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

seems like it should be... IsNumber(Number()).... else it would just return a 0 right?

Er, yeah. The error I'm getting is the If has no matching Then statement. I'm not useing the beta so maybe it somehow works on the beta? :\
Link to comment
Share on other sites

  • Developers

Er, yeah. The error I'm getting is the If has no matching Then statement. I'm not useing the beta so maybe it somehow works on the beta? :\

3.1.1.0 doesn't support comments on continuation lines......

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...