Sign in to follow this  
Followers 0
scriptstopper

While 1: what does it mean?

6 posts in this topic

Hi,

I can get:

While 1 = 1
   ...
WEnd

But I don't get:

While 1
   If ...
   EndIf
WEnd

Thanks!


don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites



It's the same thing !

While 1 == While 1=1

While <expression>

If the expression is true the following statements up to the WEnd statement are executed. This loop continues until the expression is false.


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

While 1

Wend

Is an infinite loop.Inside there should be some Exit logic like if or switch statements.

Share this post


Link to post
Share on other sites

1 == 1 evaluates to true.

1 evaluates to true.

Since both are true, both work. Similarly, you could use any other guaranteed true value like 2 == 2 or "Hello" == "Hello"

Using the single value increases the speed of the script just a bit by not having to parse the extra value and operator.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

scriptstopper,

First, Welcome to the AutoIt Forums ;)

While is looking for a 'True' Statement, and will loop eternally until the statement is no longer True. You can use any statement for While to check, as long as it can give a True or False Return.

While PixelChecksum($x,$y,$w,$h)=0 ;will continue looping until the the pixel region is no longer black
While StringInStr($text,"Running") ;will continue looping until the the $text no longer contains 'Running' in it
While $var1=$var2 ;will continue to loop until one of those variables differ from the other

So Using the statement '1' as in (While 1) is telling the loop it is always True, and to eternally loop. to exit an always true loop you will need to call 'ExitLoop'

Realm

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Almost eternally grateful.

And forgive the double-post. I thought I checked, this is a heavily-modified forum interface than what i am used to seeing (phpBB3).

;) or :) your preference.


don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

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