Zohar Posted July 23, 2017 Share Posted July 23, 2017 (edited) Hi If you open Task Manager and switch to the Processes tab, you can then select which columns to display (Menu: View\SelectColumns...) One possible column there, is "I/O Reads". How can I get the I/O Reads of a process, programmatically? If there are several ways, please tell them so i will try them and choose one.. Thank you Edited July 23, 2017 by Zohar Link to comment Share on other sites More sharing options...
Gianni Posted July 23, 2017 Share Posted July 23, 2017 .. one of possible ways using wmic: #include <AutoItConstants.au3> #include <StringConstants.au3> Local $sProcess = "explorer.exe" ; <-- your target process Local $sOutput = "" ; build your wmic query Local $sWMICquery = 'wmic process where name="' & $sProcess & '" get readoperationcount /value' ; run your query hidden and with redirected I/O streams Local $hPid = Run($sWMICquery, '', @SW_HIDE, $STDERR_MERGED) Do ; get command output Sleep(100) $sOutput &= StdoutRead($hPid) ; get wmic output from redirected streams Until @error ; error occurs when command has finished $sOutput = StringStripWS($sOutput, $STR_STRIPALL) ; remove all @cr and spaces from output MsgBox(0, 'Debug', "Process: " & $sProcess & @CRLF & $sOutput) ; show result Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Zohar Posted July 23, 2017 Author Share Posted July 23, 2017 Cool! Thank you very much Chimp Link to comment Share on other sites More sharing options...
Gianni Posted July 23, 2017 Share Posted July 23, 2017 You are welcome Here another way using WMI instead: Local $Computername = "localhost" _WMI_ProcessGetInfos($Computername) Func _WMI_ProcessGetInfos($Computername) If Ping($Computername) Then Local $vObjWMI = ObjGet("winmgmts:\\" & $Computername & "\root\cimv2") If IsObj($vObjWMI) Then ConsoleWrite("Debug: OK WMI is obj" & @CRLF) Else Return SetError(1, 0, "") ; problems EndIf ; https://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx Local $vObjItems = $vObjWMI.ExecQuery('SELECT * FROM win32_process') ; get all properties of all process If IsObj($vObjItems) Then ConsoleWrite("Debug: Total processes found: " & $vObjItems.count & @CRLF) For $vObjItem In $vObjItems ConsoleWrite($vObjItem.Name & " WriteOperationCount: " & $vObjItem.WriteOperationCount & @CRLF) ; all retrievables properties (case sensitive!) are listed in the "properties" section of following link ; https://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx Next Return SetError(0) EndIf Else ; remote computer not responding Return SetError(1, 0, "") ; problems EndIf EndFunc ;==>_WMI_ProcessGetInfos Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Zohar Posted July 23, 2017 Author Share Posted July 23, 2017 (edited) Thank you If I remember correctly, in the past, the WMI object was slow.. The DOS Command (WMIC) does not seem to have any delay, it works perfect.. So I stay with it.. Edited July 23, 2017 by Zohar Link to comment Share on other sites More sharing options...
Zohar Posted July 23, 2017 Author Share Posted July 23, 2017 BTW, Is it possible to know if the HDD is busy, not related to any specific process? 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