Sign in to follow this  
Followers 0
Idea

Simple If-Then

13 posts in this topic

#1 ·  Posted (edited)

Thanks for all the help. It's working.

Edited by Idea

Share this post


Link to post
Share on other sites



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]


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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

Thank you.

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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...

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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? :\

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

How do I concatenate as numbers then?

How about:

$a = 2
$b = 3
$c = string($a) & string($b)
$d = int($c)
MsgBox(1,"",$c & " " & $d)

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

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

Well that would be why! Does the beta support this feature?

Share this post


Link to post
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
Sign in to follow this  
Followers 0