billthecreator Posted November 26, 2007 Share Posted November 26, 2007 how can i determine the cpu usage, and then post it on a gui? is there a get code? [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
weaponx Posted November 26, 2007 Share Posted November 26, 2007 Maybe try this function here (CPU Meter):http://www.autoitscript.com/forum/index.ph...p;hl=cpu++usage Link to comment Share on other sites More sharing options...
weaponx Posted November 26, 2007 Share Posted November 26, 2007 That link I posted is old code. There is a newer version here:http://www.autoitscript.com/forum/index.ph...00&hl=meter Link to comment Share on other sites More sharing options...
billthecreator Posted November 26, 2007 Author Share Posted November 26, 2007 what about the part, $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") what do i have to change to get that working? [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
NELyon Posted November 26, 2007 Share Posted November 26, 2007 $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") for $stuff in $objWMIService MsgBox(0, "CPU", $stuff.loadpercentage & "%") next Severely untested, and i doubt this works, but it's worth a shot. Link to comment Share on other sites More sharing options...
billthecreator Posted November 27, 2007 Author Share Posted November 27, 2007 i think what i meant, was, that the location need to be changed, in order for it to work on my computer, and others [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
therks Posted November 27, 2007 Share Posted November 27, 2007 It doesn't need to be changed. $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT LoadPercentage FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then $iCPU = 0 For $objItem In $colItems $iCPU += 1 MsgBox(0, 'CPU #' & $iCPU, $objItem.LoadPercentage) Next EndIf There you go. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
billthecreator Posted November 29, 2007 Author Share Posted November 29, 2007 i keep getting this error CODE$colItems = $objWMIService.ExecQuery("SELECT LoadPercentage FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $colItems = $objWMIService^ ERROR what should i do? [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
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