zFrank Posted July 3, 2008 Share Posted July 3, 2008 (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 July 3, 2008 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" Link to comment Share on other sites More sharing options...
zFrank Posted July 3, 2008 Author Share Posted July 3, 2008 my script may look wrong because i have not written it in text editor. [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" Link to comment Share on other sites More sharing options...
realkiller Posted July 3, 2008 Share Posted July 3, 2008 I tested this script it uses 1%cpu $filter = "Test|First|Second|etc" ;and many others too $i = 50 While 1 Sleep(1); check every second If WinExists("[REGEXPTITLE:(?i)" & $filter & "]") Then WinClose("[last]") $i -= 1 If $i = 0 Then ExitLoop MsgBox(0, "example", "Test") EndIf WEnd Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
zFrank Posted July 3, 2008 Author Share Posted July 3, 2008 but as i told before i also have around 30 more words. this was just a example script. 2nd : Maybe you have tested it on a very high end pc. please give any solution for it. [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" Link to comment Share on other sites More sharing options...
zFrank Posted July 3, 2008 Author Share Posted July 3, 2008 (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 July 3, 2008 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" Link to comment Share on other sites More sharing options...
realkiller Posted July 3, 2008 Share Posted July 3, 2008 it doesn't matter how mutch words you add in to it try it first on the slowest pc and then you can see ferther:) i think every pc can handle this:) Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
realkiller Posted July 3, 2008 Share Posted July 3, 2008 if you get hich cpu usage you must set a sleep(1) to that point, play with it if you post your hole script i can look into it muttley Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted July 3, 2008 Share Posted July 3, 2008 i think you problem is the sleep (1) sleep is in milliseconds not in seconds increase the value to 1000 and try again Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
realkiller Posted July 3, 2008 Share Posted July 3, 2008 the 1 milsecond sleep is just fine if you increase it hicher it wil not improve cpu Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2 Link to comment Share on other sites More sharing options...
zFrank Posted July 4, 2008 Author Share Posted July 4, 2008 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. [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" Link to comment Share on other sites More sharing options...
Andreik Posted July 4, 2008 Share Posted July 4, 2008 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. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now