Sign in to follow this  
Followers 0
evolute

If ... Then ... AND ?

3 posts in this topic

Hello guys

Just started some basic scripting in AutoIt but have already gotten in trouble! It seems the problem lies in using If Then AND -lines, like this example:

#include <array.au3>

Local $array[25]

For $i=0 To 24

$array[$i] = Random(1,100,1)

Next


For $i=0 To 24

If $array[$i] < 35 Then $array[$i] = "BELOW 35" AND ConsoleWrite($array[$i]&" is below 35"&@CRLF)


Next


_ArrayDisplay($array, "")oÝ÷ Ù8^±ç(Ùh¢¬¶!jxjY^ÚâzÆÞ7æÚ-ë^ÆÙbꮢÐD,å·æ«¨µ©ÝyÈh¢ëp'!¢w¬{ayÊ'²^6"|îØb³­­n«¨´C
ì¢W®+^Ó~®¶²Ó~¢jjjºb±·¥£
ùªê-jjBD±jºn+p¢¹,~V°ë,&î·­Ø^z{kë"«²Ø¨ªÞnz-ý·!jxvÚ*ºA³ß®¢Öî¶Ú*ºS®çªºwÜz0z÷«òÅÈZ­âN§Ðåw¢¶zW´&¬zX¤y«­¢+Ø¥¹±Õ±ÐíÉÉä¹ÔÌÐì()1½°ÀÌØíÉÉålÈÕt()½ÈÀÌØí¤ôÀQ¼ÈÐ((ÀÌØíÉÉålÀÌØí¥tôI¹½´ Ä°ÄÀÀ°Ä¤()9áÐ(()½ÈÀÌØí¤ôÀQ¼ÈÐ((í%ÀÌØíÉÉålÀÌØí¥t±ÐìÌÔQ¡¸ÀÌØíÉÉålÀÌØí¥tôÅÕ½Ðí 1=ÌÔÅÕ½Ðì9
½¹Í½±]É¥Ñ ÀÌØíÉÉålÀÌØí¥tµÀìÅÕ½Ðì¥Ì±½ÜÌÔÅÕ½ÐìµÀí
I1¤()M±Ð(%
ÍÀÌØíÉÉålÀÌØí¥t±ÐìÌÔ($%
½¹Í½±]É¥Ñ ÀÌØíÉÉålÀÌØí¥tµÀìÅÕ½Ðì¥Ì±½ÜÌÔÅÕ½ÐìµÀí
I1¤($$ÀÌØíÉÉålÀÌØí¥tôÅÕ½Ðí   1=ÌÔÅÕ½Ðì)¹M±Ð()9áÐ(()}ÉÉå¥ÍÁ±ä ÀÌØíÉÉä°ÅÕ½ÐìÅÕ½Ðì¤oÝ÷ Ù8^Ø^±Êâ¦Ü(®K+"²z-ë-­éZµçm *'²^Z¸­yú+{¦¦W­+,r¸©·br"+×½êòz{kÊÞ¯~m¢Ø^rì¢Wº×!jxz{këzZ0¶az×±¶X§x
ij·§¶®²)àlC
í{.)ý¼"V¥Á¬¬+Þæ¬Ê{ZÅê뢶®¶­sb6æ6ÇVFRfÇC¶'&æS2fwC° ¤Æö6Âb33c¶'&³#UÐ ¤f÷"b33c¶ÓFò#@ ¢b33c¶'&²b33c¶ÒÒ&æFöÒÃà ¤æW@  ¤f÷"b33c¶ÓFò#@ ¤bb33c¶'&²b33c¶ÒfÇC²3RFVâb33c¶'&²b33c¶ÒÒgV÷C´$TÄõr3RgV÷C²äB6öçFçVTÆö÷ ¤6öç6öÆUw&FRb33c¶'&²b33c¶ÒfײgV÷C²2æ÷B&VÆ÷r3RgV÷C²f×´5$Äb ¤æW@ ¥ô'&F7Æb33c¶'&ÂgV÷C²gV÷C²

Is this a bug or am I doing something wrong? I am using AutoIt v3.2.4.9 and WinXp.

Share this post


Link to post
Share on other sites



You cannot put 2 lines on one with an AND in between:

If $array[$i] < 35 Then $array[$i] = "BELOW 35" AND ConsoleWrite($array[$i]&" is below 35"&@CRLF)

That should be:

If $array[$i] < 35 Then 
    $array[$i] = "BELOW 35" 
    ConsoleWrite($array[$i]&" is below 35"&@CRLF)
EndIf

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
:) I was dead sure ive done it before, but should have read the reference more carefully! It clearly says that its the expression, not the statment, that can use boolean operators. Cheers!

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