Jump to content

Recommended Posts

Posted

Are there best practices to keep AutoIt scripts

easy on the CPU?

I'm on a Q6600@2.4Ghz with Win7 and my floating toolbar

script costs a constant 5-8%.

With a sleep(100) in the main loop it gets down

to 1-2%, but I read somewhere that a sleep is not

recommended there.

Posted

Well, I am using GUIGetMsg().

So sleep makes the gui laggy... Hmm, I guess I'll have to

experiment with sleep times and see which value starts to cause

problems.

Posted (edited)

Zoltan, try replacing:

Toolbar_State()     ; Toggle "AlwaysOnTop" setting as required.
    Local $iMsg = GUIGetMsg() ; Check if an event has happened on the UI.

with

Local $iMsg = GUIGetMsg() ; Check if an event has happened on the UI.
    ; avoid unnecessary processing when no events ...
    If $iMsg = 0 Then ContinueLoop
    Toolbar_State()     ; Toggle "AlwaysOnTop" setting as required.

Of course this will only help if it actually is Toolbar_State() that eats your CPU :mellow:

edit: not tested, don't have PS

HTH,

whim

Edited by whim

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