Jump to content

Recommended Posts

Posted

I am getting 25% Usage which spikes to 40% sometimes, for the first 2-3mins its fine.

dim $WindowClasses[11][6]

;window classes
$WindowClasses[0][0]="DME - Class"
$WindowClasses[1][0]="Database - L3SynStats.db"
$WindowClasses[2][0]="MaxViewer"
$WindowClasses[3][0]="INRR"
$WindowClasses[4][0]="EMView"
$WindowClasses[5][0]="EventWatcher"
$WindowClasses[6][0]="DDBS"
$WindowClasses[7][0]="1A"
$WindowClasses[8][0]="3D"
$WindowClasses[9][0]="2D"
$WindowClasses[10][0]="Loader"

;x-coords
$WindowClasses[0][2]=0
$WindowClasses[1][2]=840
$WindowClasses[2][2]=1680
$WindowClasses[3][2]=2520
$WindowClasses[4][2]=0
$WindowClasses[5][2]=840
$WindowClasses[6][2]=1680
$WindowClasses[7][2]=0
$WindowClasses[8][2]=0
$WindowClasses[9][2]=840
$WindowClasses[10][2]=970

;y-coords
$WindowClasses[0][3]=0
$WindowClasses[1][3]=0
$WindowClasses[2][3]=0
$WindowClasses[3][3]=0
$WindowClasses[4][3]=380
$WindowClasses[5][3]=380
$WindowClasses[6][3]=380
$WindowClasses[7][3]=0
$WindowClasses[8][3]=380
$WindowClasses[9][3]=380
$WindowClasses[10][3]=0

;m1
$WindowClasses[0][4]=834
$WindowClasses[1][4]=834
$WindowClasses[2][4]=834
$WindowClasses[3][4]=834
$WindowClasses[4][4]=834
$WindowClasses[5][4]=834
$WindowClasses[6][4]=834
$WindowClasses[7][4]=834
$WindowClasses[8][4]=834
$WindowClasses[9][4]=834
$WindowClasses[10][4]=712

;m2
$WindowClasses[0][5]=628
$WindowClasses[1][5]=628
$WindowClasses[2][5]=628
$WindowClasses[3][5]=628
$WindowClasses[4][5]=628
$WindowClasses[5][5]=628
$WindowClasses[6][5]=628
$WindowClasses[7][5]=628
$WindowClasses[8][5]=628
$WindowClasses[9][5]=628
$WindowClasses[10][5]=178

for $i=0 to 10
    $WindowClasses[$i][1]=True
Next

while 1
    for $i=0 to 10
    If WinExists($WindowClasses[$i][0]) And $WindowClasses[$i][1]=true Then
    WinMove($WindowClasses[$i][0], "", $WindowClasses[$i][2], $WindowClasses[$i][3], $WindowClasses[$i][4], $WindowClasses[$i][5])
    $WindowClasses[$i][1]=False
    EndIf
    If (Not WinExists ($WindowClasses[$i][0])) And $WindowClasses[$i][1] = False Then $WindowClasses[$i][1]=True
    Next
WEnd
Posted

See what happens if you put a Sleep(500) right before WEnd.

Feel like such a dipshit now lol, I thought I had one in there :| oops

Put a 50ms sleep and its fine :mellow: 1-2%cpu :P

Posted

I've read on the forums that putting a tiny sleep, like

Sleep(10)

in your loops helps reduce CPU usage

It definitly helps, except in the case of a GUI msg loop where it is already accounted for with the default being either 250 or 275 milliseconds. Any longer than that and you start to notice degradation of the control reaction time.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
×
×
  • Create New...