Jump to content
Sign in to follow this  
unknown12

Only once?

Recommended Posts

unknown12

I've got this while loop:

While FileExists($Script)

   WEnd

How can I make something happen only once inside the loop, but keep it going?

I've already tried do...until but maybe i wasnt doing it right.

Share this post


Link to post
Share on other sites
Helge

I think this is what you need..

While 1
    Sleep(10) ; lowers CPU-usage
    
    If FileExists($file) Then
        ; do something
    EndIf
WEnd
Edit : I read thru it a couple of times and it made me unsure..

Could you explain what you mean, a little bit more detailed ?

Edited by Helge

Share this post


Link to post
Share on other sites
unknown12

Sorry, does this make any more sense?

While 1
    While FileExists($file)
    send("Hello!")
    WEnd
WEnd

That will repeatedly send the text "Hello!". I want to only send the text once. How could I do this?

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

like ???

$status = 0
$file = "c:\temp\java.txt"

While 1
    If FileExists($file) And $status = 0 Then
        Send("Hello!")
        $status = 1
        Sleep(1000)
    EndIf
    Sleep(100)
WEnd

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.