RogFleming Posted October 31, 2010 Share Posted October 31, 2010 Using the Help the following works fine Local $foo = Run("WMIC.exe"&" "&"/node:dtescan01 Path Win32_Processor GET LoadPercentage","",@SW_HIDE,$STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend MsgBox(0, "Debug", "Exiting...") But it slows down the main script having to wait for the Run command to finish looking for something thing like this to work but right now does not, trying to update a progressbar with a LoadPrecentage value from WMIC #include <Constants.au3> GUICreate("OU Admin Monitor",210,85,10,665,$WS_POPUP,$WS_EX_TOPMOST,$sOuadminwin) $SCAN1UtilLbl = GUICtrlCreateLabel("DTESCAN1 CPU",5,5,200,20) $SCAN1UtilPb = GUICtrlCreateProgress(5, 25, 200, 20,$PBS_SMOOTH) ShellExecute("WMIC.exe","node:dtescan01 /Output:STDOUT Path Win32_Processor GET LoadPercentage","","Open",@SW_HIDE) Local $foo = ProcessExists("wmic.exe") If @error Then MsgBox(1,"",@error) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop If $Line <> "" Then $Scan1cpu = StringInstr($Line,"some sort regexpress to get numeric value from WMIC output",0,0,1) GUICtrlSetData($SCAN1UtilLbl, "DTESCAN1 CPU"&" "&$Scan1cpu&"%") GUICtrlSetData($SCAN1UtilPb, $Scan1cpu) Endif Wend Link to comment Share on other sites More sharing options...
RogFleming Posted October 31, 2010 Author Share Posted October 31, 2010 (edited) update code but does not help much #include <Constants.au3> Local $foo = Run("WMIC.exe"&" "&"/node:dtescan01 Path Win32_Processor GET LoadPercentage","",@SW_HIDE,$STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($foo) If @error Then ExitLoop If $line <> "" Then MsgBox(1,"",StringRegExp($line,'([0-9]{1,2})')) EndIf Wend Edited October 31, 2010 by RogFleming Link to comment Share on other sites More sharing options...
wakillon Posted October 31, 2010 Share Posted October 31, 2010 (edited) i have tried your last script but it return only one value how do you want increment your progress bar ? or may be it's a LoadPercentage "meter" Edited October 31, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
RogFleming Posted November 2, 2010 Author Share Posted November 2, 2010 i have tried your last script but it return only one valuehow do you want increment your progress bar ?or may be it's a LoadPercentage "meter"It's load meter the value would be passed and the progressbar would adjust to the current value.Currently the working model I have is I spawn off a process which sends WMI commands to the remote machine and I update an embeded progressbar.Looking for a little tighter solution. Link to comment Share on other sites More sharing options...
RogFleming Posted November 4, 2010 Author Share Posted November 4, 2010 (edited) It's load meter the value would be passed and the progressbar would adjust to the current value.Currently the working model I have is I spawn off a process which sends WMI commands to the remote machine and I update an embeded progressbar.Looking for a little tighter solution.Seems the standard pipe might be the best wayRun("WMIC.exe"&" "&"/node:dtescan01 Path Win32_Processor GET LoadPercentage >> LoadPercentage.log","",@SW_HIDE)Then do a While 1$file = FileExist(LoadPercentage.log)FileReadLine($file,2)_FileDelete(LoadPercentage.log)WEND Edited November 4, 2010 by RogFleming 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