Jump to content
Sign in to follow this  

For $a in $b loop slow

Recommended Posts


Here is the code I am using:

-------START CODE-----------

Func Update_Current_CPU()

$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL",_

$wbemFlagReturnImmediately + $wbemFlagForwardOnly)

For $objItem In $colItems


GUICtrlSetData($Group1,"Current CPU Load: " & $objItem.LoadPercentage)



---------END CODE------------

I have anrrowed the problem down to the For/Next loop. I can comment out the GUICtrlSetData line, and it still taked over 2 seconds to process the For loop. I used a TimeDiff to test just the $colItems command and it took 4/1000 of a second. The For loop took over 2 seconds to complete. During this time, the GUI is unresponsive.

I am running beta.

Share this post

Link to post
Share on other sites

I understand you post the function but how to call it regarding global variable used inside.

Can you post the calling sequence?

THanks :o

EDIT : move to support forum as there is no feedback

Edited by jpm

Share this post

Link to post
Share on other sites

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
Sign in to follow this