Jump to content

Recommended Posts

Posted (edited)

in my script i need to close and show many windows.

i used

$filter = "Test|First|Second|etc" ;and many others too
$i = 50
While Sleep(1000); check every second
    If WinExists("[REGEXPTITLE:(?i)" & $filter & "]") Then
        WinClose("[last]")
        $i -= 1
        If $i = 0 Then ExitLoop
        MsgBox(0, "example", "Test"
    EndIf
WEnd

i need to use around 30 more words but it is taking 95% cpu usage and ram usage.

i have to run the window check until i finds the window of my choice.

i also added sleep but adding sleep slows the process and also script uses 85-95%

please give me a suggestion on how can i reduce the cpu usage.

thanks.

Edited by zFrank
[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"
Posted (edited)

this script will run in a office on 100 computers.

their config is... as follow

Win98 , 500mhz processor and 128mb ram.

because in this office there is no need of high quality pcs. but this is a problem/challenge for me. i hope any good and/or expert will help me.

Edited by zFrank
[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"
Posted

okkk, my problem is not solved it still uses 90% after giving Sleep(1000) and i can't give it more Sleep() please give any other solution.

$A = 1
While $A < 3
    $B = 1
    While $B < 580
               if winexists("Test") Then
               WinClose("Test")
               ElseIf winexists("Example") Then
                     WinClose("Example")
               EndIf
               if winexists("Test33") Then
               ExitLoop
           EndIf 
           Sleep(25)
       Wend
       Sleep(25)
Wend

Sleep your script 25 miliseconds in every loop, and memory usage will be reduced.

For me is between 6% and 9% CPU Usage.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...