Sign in to follow this  
Followers 0
pintas

'While'

5 posts in this topic

I was making a big script and everytime i started it i noticed the processor went crazy. After some tests, i found out that the 'while' loop was the cause for it.

For example:

While 1
If ProcessExists("notepad.exe") Then
ProcessClose("notepad.exe")
Endif
Wend

This makes my processor use about 80% to 100% of it's capability. My centrino isn't much, but is this normal?

What can i do to preserve the processor resources?

Thank you.

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

While 1
If ProcessExists("notepad.exe") Then
ProcessClose("notepad.exe")
Endif
sleep(1000)
Wend

should stop the processor usage.. its becuause the Ifstatement is constantly being called .. with no breaktime.


Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
Share on other sites

Use always Sleep().

While 1
    If ProcessExists("notepad.exe") Then
        ProcessClose("notepad.exe")
    EndIf
    Sleep(1000)
WEnd

lol snap

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
Share on other sites

Wow. Simple and effective.

Love it!

Thanks guys.

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