Rex Posted July 31, 2005 Posted July 31, 2005 Yo i'd made a wery litle script, for one of my frinds who likes to see porno on the internet. The script i did is desigend to auto close some autoInstall popups. The script work sofar ok, but it uses a lot of cpu power course i da my checks in a while 1. My problem is now that i have seen me blinde on how to lover the cpu usage Please some one give me a hint... Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("RunErrorsFatal", 0) ;1=fatal, 0=silent set @error Opt("TrayMenuMode", 1) Opt("TrayOnEventMode",1) $exit = TrayCreateItem("Exit") TrayItemsetOnEvent(-1,"Off") TraySetState() TraySetIcon("shell32.dll", 65) While 1 If WinExists("Advarsel",'Vil du installere og køre') Then; #32770 WinActivate("Advarsel",'Vil du installere og køre') ; Send("!N") WinKill("Advarsel",'Vil du installere og køre') EndIf If WinExists("Microsoft Internet Explorer",'You must click YES') Then WinActivate("Microsoft Internet Explorer",'You must click YES') WinKill("Microsoft Internet Explorer",'You must click YES') WinClose("Microsoft Internet Explorer",'You must click YES') ;Send("{ENTER}") EndIf WEnd Func Off() Exit EndFunc
GaryFrost Posted July 31, 2005 Posted July 31, 2005 just put a short sleep in the while loop like Sleep ( 10 ) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
LxP Posted August 1, 2005 Posted August 1, 2005 If you still find the CPU usage to be high then try a larger number like Sleep(100). People have been discussing elsewhere that small Sleep() values don't lower CPU usage.
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