Jump to content

Recommended Posts

Guest Spike
Posted

Greetings from Downunder,

I've just written this poor man's cookie cruncher for Opera 7.23

It works ok but uses 100% cpu cycles.

Any suggestion for recoding to reduce cpu cycles ??????

TIA

Spike

here is the code

Global $Paused

HotKeySet("{F10}", "Terminate"); example F10 to exit

$title=0

while $title=0

$title=winactive("The server wishes to send you a cookie")

if $title=1 then

;MsgBox(0, "Value =","cookie time")

;sleep(1000)

winkill("The server wishes to send you a cookie")

$title=0

endif

wend

Func Terminate()

Exit 0

EndFunc

Posted

Greetings from Downunder,

I've just written this poor man's cookie cruncher for Opera 7.23

It works ok but uses 100% cpu cycles.

Any suggestion for recoding to reduce cpu cycles ??????

TIA

Spike

here is the code

Global $Paused

HotKeySet("{F10}", "Terminate"); example F10 to exit

$title=0

while  $title=0

$title=winactive("The server wishes to send you a cookie")

if $title=1 then

;MsgBox(0, "Value =","cookie time")

;sleep(1000)

winkill("The server wishes to send you a cookie")

$title=0

endif

wend

Func Terminate()

  Exit 0

EndFunc

Put Sleep(100) in at the beginning or the ending of your loop. :whistle:

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Guest Spike
Posted

Thanks Gene,

That fixed it, but why ??

Any explanations ???

Tia

Spike

Posted

AutoIt runs balls out. Even though it was doing nothing, it was doing it very very fast and thus, using up cycles. By telling it to Sleep for 100 ms, you are literally telling it to slow down and pause for 100 ms between times the loop executes.

Guest Spike
Posted

Thanks Valik,

I sort of came to that answer myself after i sat down

and thought about it for a while!

Thanks for the help everybody.

Spike

Posted

You can dramatically reduce autoit from 100%CPU to say 2% CPU by adding Sleep(1) or sleep(10)

Your popups would be virtually killed before they start without a huge CPU use.

AutoIt3, the MACGYVER Pocket Knife for computers.

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...