GEOSoft Posted February 22, 2008 Posted February 22, 2008 I'll throw a test scrip together today. It must be in the call to _ArraySort() I'm probably trying to sort on the wrong dimension. For AutoIt version see the @AutoItVersion macro as well as a function to do what you want that was just posted in example scripts this morning. MsgBox(0, "Version", "You are currently using version " & @AutoItVersion) If you have the path to AutoIt.exe then you could also use FileGetVersion(path & "\AutoIt.exe") 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!"
GEOSoft Posted February 22, 2008 Posted February 22, 2008 Okay, it was a problem with parameters in the call to _ArraySort. _ArraySort($a, 0, 1, 0, 2) This is tested and working. It looks to me like you are probably using version 3.2.8.1 of AutoIt BTW. I am assuming here that you still have the sort functions that I gave you in your script and that you do NOT have #include<array.au3> or at least have it commented out. If this works fine then you will probably be able to add the #include<array.au3> back in and comment out the sort functions using #CS/#CE. If you do that you may also find that updating AutoIt will break this code since there were several changes to array.au3. Besides these are the only functions you need so why bother #including the whole file? 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!"
Diana (Cda) Posted February 22, 2008 Posted February 22, 2008 Okay, it was a problem with parameters in the call to _ArraySort. _ArraySort($a, 0, 1, 0, 2) This is tested and working. It looks to me like you are probably using version 3.2.8.1 of AutoIt BTW. I am assuming here that you still have the sort functions that I gave you in your script and that you do NOT have #include<array.au3> or at least have it commented out.<g> At this point, I'm not sure ... My head is whirling at this point. However, the script below seems to be working just fine with just that small modification:#Include<array.au3> $a = ProcessList() $List = "" _ArraySort($a, 0, 1, 0, 2) For $i = 1 To $a[0][0] $list &= $a[$i][0] & @CRLF Next ClipPut($list)It gave me this -- sorted and without all the extra, unnecessary info -- so looks absolutely great to me!:expandcollapse popup[System Process] 3dClip.exe agentsvr.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe csrss.exe etlisrv.exe etlitr50.exe explorer.exe FaxCtrl.exe firefox.exe FrameworkService.exe KanaWall.exe lsass.exe MAPISP32.EXE Mcshield.exe Mctray.exe Metapad.exe MMKeybd.exe Mmusbkb2.exe MsPMSPSv.exe naPrdMgr.exe nhksrv.exe ntvdm.exe osd.exe OUTLOOK.EXE pnagent.exe powerpro.exe PrintKey 2000 v5.05.exe PStart.exe qttask.exe SciTe.exe services.exe shstat.exe smss.exe SpmonNT.exe spoolsv.exe ssonsvr.exe svchost.exe svchost.exe svchost.exe svchost.exe svchost.exe svchost.exe System tclock2.exe TrayMon.exe UdaterUI.exe VsTskMgr.exe winlogon.exe wonderfl.exe Re findint out the AI version #, I'm going to try the couple of scripts kindly given here that will display the version. This is just such a good thing to have, eh? That'll make life easier in future for when I forget which copy of AI I have. If this works fine then you will probably be able to add the #include<array.au3> back in and comment out the sort functions using #CS/#CE. If you do that you may also find that updating AutoIt will break this code since there were several changes to array.au3. Besides these are the only functions you need so why bother #including the whole file?Since the above is working just fine, I'd just as soon not fix what's not broken <g>. I'm not sure if the simple, yet elegant script above will be "broken" when I install the latest AI but I'll be sure to try it once I have the latest version "installed". I'll try to get to that this weekend. Thanks!
GEOSoft Posted February 22, 2008 Posted February 22, 2008 I don't think it will break when you update but if it does then it won't take much to fix it.Good luck 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!"
ptrex Posted February 23, 2008 Posted February 23, 2008 @all I am always glad to throw in my 2 cents expandcollapse popupAutoItSetOption("TrayIconHide", 1) #include <array.au3> $avRET = _ProcessListProperties() For $x = 1 To UBound($avRET) -1 $avRET[$x][7] = Number($avRET[$x][7]) Next _ArraySort($avRET, 1, 0, -1, UBound($avRET,2), 7) _ArrayDisplay($avRET) ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is all ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; ... ; [n][0] thru [n][7] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Notes: If a numeric PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs If $Process = "" Then $avProcs = ProcessList() Else $avProcs = ProcessList($Process) EndIf ; Return for no matches If $avProcs[0][0] = 0 Then Return $avProcs ; ReDim array for additional property columns ReDim $avProcs[$avProcs[0][0] + 1][8] ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection of all processes from Win32_Process $colProcs = $oWMI.ExecQuery ("select * from win32_process") If IsObj($colProcs) Then ; For each process... For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.ProcessId Then ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner ($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ExitLoop EndIf Next Next Else SetError(2) ; Error getting process collection from WMI EndIf ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum ($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(10) Until TimerDiff($iTime) > 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then $avProcs[$n][6] = $oProc.PercentProcessorTime $avProcs[$n][7] = $oProc.WorkingSet ExitLoop EndIf Next Next Else SetError(1) ; Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
GEOSoft Posted February 23, 2008 Posted February 23, 2008 @all I am always glad to throw in my 2 cents expandcollapse popupAutoItSetOption("TrayIconHide", 1) #include <array.au3> $avRET = _ProcessListProperties() For $x = 1 To UBound($avRET) -1 $avRET[$x][7] = Number($avRET[$x][7]) Next _ArraySort($avRET, 1, 0, -1, UBound($avRET,2), 7) _ArrayDisplay($avRET) ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is all ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; ... ; [n][0] thru [n][7] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Notes: If a numeric PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs If $Process = "" Then $avProcs = ProcessList() Else $avProcs = ProcessList($Process) EndIf ; Return for no matches If $avProcs[0][0] = 0 Then Return $avProcs ; ReDim array for additional property columns ReDim $avProcs[$avProcs[0][0] + 1][8] ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection of all processes from Win32_Process $colProcs = $oWMI.ExecQuery ("select * from win32_process") If IsObj($colProcs) Then ; For each process... For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.ProcessId Then ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner ($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ExitLoop EndIf Next Next Else SetError(2) ; Error getting process collection from WMI EndIf ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum ($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(10) Until TimerDiff($iTime) > 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then $avProcs[$n][6] = $oProc.PercentProcessorTime $avProcs[$n][7] = $oProc.WorkingSet ExitLoop EndIf Next Next Else SetError(1) ; Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties regards ptrexNice script !! Now all I have to do is remember where it's posted so I can find it in the future. 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!"
ptrex Posted February 23, 2008 Posted February 23, 2008 @GEOSoft I know that's becoming a problem You can also save it to your disk. But that's not a good alternative too. Because then you have to remember where you saved it regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
ptrex Posted February 23, 2008 Posted February 23, 2008 @GEOSoft I know that's becoming a problem You can also save it to your disk. But that's not a good alternative too. Because then you have to remember where you saved it regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
GEOSoft Posted February 23, 2008 Posted February 23, 2008 @GEOSoftI know that's becoming a problem You can also save it to your disk.But that's not a good alternative too. Because then you have to remember where you saved it regardsptrexEasier to find it on my disk though so thats the way I went. Just put it in a new folder in my D:\Downloads\AutoIt\Scripts folder. Tough to find some of these again in the forum unless Valuater adds it to his wrappers. 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!"
Diana (Cda) Posted March 7, 2008 Posted March 7, 2008 (edited) I'll throw a test scrip together today. It must be in the call to _ArraySort() I'm probably trying to sort on the wrong dimension. For AutoIt version see the @AutoItVersion macro as well as a function to do what you want that was just posted in example scripts this morning. MsgBox(0, "Version", "You are currently using version " & @AutoItVersion) If you have the path to AutoIt.exe then you could also use FileGetVersion(path & "\AutoIt.exe")That is so cool! It's at the top of all my AI scripts ... CHECK FOR AUTOIT VERSION ... --------------------------------------- Here's my take on it ('cause I just always have to stick my oar in ... <g>): ClipPut("AutoIt version you are using is: " & @AutoItVersion) MsgBox(0, "", "You are currently using AutoIt v" & @AutoItVersion & "." & @CRLF & @CRLF & "(This info. has been sent to the clipboard.")Using this script, therefore: "AutoIt version you are using is: 3.2.10.0" Hmmm, from this page: http://www.autoitscript.com/forum/index.ph...s&showcat=2 ... The current stable release version of AutoIt. v3.2.8.1 - 10th Sept 2007 The latest AutoIt v3 beta version. v3.2.9.1 - 18th Sept, 2007 How can I have what looks like a later release???!!! <g> Thanks. Edited March 7, 2008 by Diana (Cda)
Diana (Cda) Posted March 7, 2008 Posted March 7, 2008 @all I am always glad to throw in my 2 cents AutoItSetOption("TrayIconHide", 1) #include <array.au3> $avRET = _ProcessListProperties() For $x = 1 To UBound($avRET) -1 $avRET[$x][7] = Number($avRET[$x][7]) Next _ArraySort($avRET, 1, 0, -1, UBound($avRET,2), 7) _ArrayDisplay($avRET) ...That is a neat script. Very different from what we're doing here but it sure gives a nicer and more informative display of information than Windows Task Manager does!
Diana (Cda) Posted March 7, 2008 Posted March 7, 2008 #Include<array.au3> $a = ProcessList() $List = "" _ArraySort($a, 0, 1, 0, 2) For $i = 1 To $a[0][0] $list &= $a[$i][0] & @CRLF Next ClipPut($list)oÝ÷ Ûú®¢×¡Øçl(!¶¢Øb±«¢+Ø%¹±Õ±ÐíÉÉä¹ÔÌÐì(¥¹±Õ±Ðí ½¹ÍѹÑ̹ÔÌÐì((ÀÌØíôAɽÍÍ1¥ÍÐ ¤(ÀÌØí1¥ÍÐôÅÕ½ÐìÅÕ½Ðì)}ÉÉåM½ÉÐ ÀÌØí°À°Ä°À°È¤)½ÈÀÌØí¤ôÄQ¼ÀÌØílÁulÁt(ÀÌØí±¥ÍеÀìôÀÌØílÀÌØí¥ulÁtµÀì I1)9áÐ(() ±¥ÁAÕÐ ÀÌØí±¥ÍФ()5Í ½à À°ÅÕ½ÐíAɽÍÍ̸¸¸mQ¡¥Ì½àÑ¥µÌ½ÕйtÅÕ½Ðì°ÅÕ½ÐíQ¡±¥ÍнÁɽÍÍÌÕÉɹѱäÉÕ¹¹¥¹¡Ì¸Í¹ÐѼѡ±¥Á½É¸ÅÕ½Ðì°Ð¤Today, the list I get is this:[System Process] AutoIt3.exe AutoIt3.exe AutoIt3.exe AutoIt3.exe csrss.exe etlisrv.exe etlitr50.exe explorer.exe FrameworkService.exe LMS.exe lsass.exe MAPISP32.EXE Mcshield.exe Mctray.exe naPrdMgr.exe ntvdm.exe qttask.exe services.exe shstat.exe smax4pnp.exe smss.exe SpmonNT.exe spoolsv.exe ssonsvr.exe svchost.exe svchost.exe svchost.exe svchost.exe svchost.exe System winlogon.exe(List cut short a bit because it was big!) Being fresher and after getting close to what's needed, I think that it would be nicer to have cleaner results after all. I was ready to give up before because the list finally was happening. But I also know that clean, elegant and simple results are always best. Is there a way to cut out the extra information, i.e., the "[system Process]" text and all the duplicates? In fact something like this output would be much better and more useful:List of running processes: AutoIt3.exe csrss.exe etlisrv.exe etlitr50.exe explorer.exe FrameworkService.exe LMS.exe lsass.exe MAPISP32.EXE Mcshield.exe Mctray.exe Metapad.exe naPrdMgr.exe ntvdm.exe qttask.exe services.exe shstat.exe smax4pnp.exe smss.exe SpmonNT.exe spoolsv.exe ssonsvr.exe svchost.exe System What does anyone think, can it be done? Thanks!!
Diana (Cda) Posted March 7, 2008 Posted March 7, 2008 CHECK FOR AUTOIT VERSION ... --------------------------------------- [snip] "AutoIt version you are using is: 3.2.10.0" [snip]Another interesting thing. I just compiled this AU3 and the compiled EXE gives me this: "AutoIt version you are using is: 3.2.5.0" Verrryyyy interesting ..... <g> So something to watch out for!
PsaltyDS Posted March 7, 2008 Posted March 7, 2008 (edited) (List cut short a bit because it was big!) Being fresher and after getting close to what's needed, I think that it would be nicer to have cleaner results after all. I was ready to give up before because the list finally was happening. But I also know that clean, elegant and simple results are always best. Is there a way to cut out the extra information, i.e., the "[system Process]" text and all the duplicates? Those are not duplicate reports of the same process. There are multiple instances of those processes running. You should see different PID numbers for each one. Once you get the 2D array, you can filter it any way you like, but the function won't filter it for you. By looping through the array, you could just pull the names, and not pull multiple processes with the same name if that's what you want: #include <array.au3> $avRET = _ProcessListProperties() If @error Then Exit _ArrayDisplay($avRET, "Before filtering") $sProcesses = Chr(1) For $n = 1 To $avRET[0][0] If Not StringInStr($sProcesses, Chr(1) & $avRET[$n][0] & Chr(1)) Then $sProcesses &= $avRET[$n][0] & Chr(1) Next $avFiltered = StringSplit(StringTrimRight(StringTrimLeft($sProcesses, 1), 1), Chr(1)) _ArrayDisplay($avFiltered, "After filtering") _ArraySort($avFiltered, 0, 1) _ArrayDisplay($avFiltered, "After sorting") You'll need to paste in the _ProcessListProperties() UDF, but it works exactly the same if you just replace that function with the native ProcessList(), assuming you don't need the rest of the process info you get from the UDF. Edited March 7, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
GEOSoft Posted March 8, 2008 Posted March 8, 2008 Another interesting thing. I just compiled this AU3 and the compiled EXE gives me this:"AutoIt version you are using is: 3.2.5.0"Verrryyyy interesting ..... <g>So something to watch out for! Current AutoIt Release version 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!"
Diana (Cda) Posted March 8, 2008 Posted March 8, 2008 Those are not duplicate reports of the same process. There are multiple instances of those processes running. You should see different PID numbers for each one. Once you get the 2D array, you can filter it any way you like, but the function won't filter it for you.Yes, that is understood. I didn't mean they were duplicate processes, sorry for confusion. I was speaking of duplicates names appearing. My purpose in this script is not for the processes themselves but for the names. When doing AI scripting, there are quite a few times when I need to know the process name and got tired of opening up Task Manager, hunting down the name of the target app running and carefully typing out the name identical to what is being displayed. This script gives me the processes in a more useful way that I can just copy-paste into my AI script. By looping through the array, you could just pull the names, and not pull multiple processes with the same name if that's what you want: #include <array.au3> $avRET = _ProcessListProperties() If @error Then Exit _ArrayDisplay($avRET, "Before filtering") $sProcesses = Chr(1) For $n = 1 To $avRET[0][0] If Not StringInStr($sProcesses, Chr(1) & $avRET[$n][0] & Chr(1)) Then $sProcesses &= $avRET[$n][0] & Chr(1) Next $avFiltered = StringSplit(StringTrimRight(StringTrimLeft($sProcesses, 1), 1), Chr(1)) _ArrayDisplay($avFiltered, "After filtering") _ArraySort($avFiltered, 0, 1) _ArrayDisplay($avFiltered, "After sorting") You'll need to paste in the _ProcessListProperties() UDF, but it works exactly the same if you just replace that function with the native ProcessList(), assuming you don't need the rest of the process info you get from the UDF. Wow, you lost me. I didn't understand all of this, unfortunately. Still a noob after all this time in many ways <lol>. Can I still use my original script above? It does exactly what I need except the output list gives me every entry and doesn't take out the "duplicate" names of processes, which would be the ideal.
Diana (Cda) Posted March 8, 2008 Posted March 8, 2008 Current AutoIt Release versionOkay, that's where I must have gotten the version I have. The downloads page shows 2 older versions.Since I use AI as a standalone, I'm guessing I must then have an old compiler. I don't remember if that's a new one or left over from a previous installation long ago. Will have to reinstall and grab the latest tools.Thanks for the heads up re the better link.
PsaltyDS Posted March 8, 2008 Posted March 8, 2008 Can I still use my original script above? It does exactly what I need except the output list gives me every entry and doesn't take out the "duplicate" names of processes, which would be the ideal. Here's the basic script stripped down to do just the sorted list, without the extraneous demo stuff: #include <array.au3> $a = ProcessList() _ArraySort($a, 0, 1) $list = @CRLF For $i = 1 To $a[0][0] If Not StringInStr($list, @CRLF & $a[$i][0] & @CRLF) Then $list &= $a[$i][0] & @CRLF Next $list = StringTrimRight(StringTrimLeft($list, 1), 1) ClipPut($list) There isn't much fat left in this. The @CRLF delimiters may look extraneous, but they prevent false matches on substrings. So "Proc.exe" doesn't get left out because "MyProc.exe" is already listed. This will trigger a bug in the _ArraySort() on a 2D array if you run it with 3.2.10.0. The bug was fixed in the 3.2.11.x Betas, so run/compile with beta. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Diana (Cda) Posted March 10, 2008 Posted March 10, 2008 (edited) Here's the basic script stripped down to do just the sorted list, without the extraneous demo stuff: #include <array.au3> $a = ProcessList() _ArraySort($a, 0, 1) $list = @CRLF For $i = 1 To $a[0][0] If Not StringInStr($list, @CRLF & $a[$i][0] & @CRLF) Then $list &= $a[$i][0] & @CRLF Next $list = StringTrimRight(StringTrimLeft($list, 1), 1) ClipPut($list)Hi, it seems I've come full circle. Does that mean I give up, or what??!! <g> The above gives me the same error as in post 16, the "Array variable has incorrect number of subscripts or subscript dimension range exceeded" (like that could be Chinese for me as I still don't understand it <g>). Anyway, GEOsoft in post 22 came back to say ... Okay, it was a problem with parameters in the call to _ArraySort. _ArraySort($a, 0, 1, 0, 2) This is tested and working. It looks to me like you are probably using version 3.2.8.1 of AutoIt BTW. I am assuming here that you still have the sort functions that I gave you in your script and that you do NOT have #include<array.au3> or at least have it commented out. If this works fine then you will probably be able to add the #include<array.au3> back in and comment out the sort functions using #CS/#CE. If you do that you may also find that updating AutoIt will break this code since there were several changes to array.au3. Besides these are the only functions you need so why bother #including the whole file?The above script that I have works without errors, as I mentioned in post 32 above. It just gives me a list of all the process names running when I don't need "duplicate" names. I was just hoping to cut out the "duplicates". I've ascertained that I have AutoIt 3.2.5.0, thanks to a modified script based on the very handy dandy one GEOsoft provided in post 21, so I'm at a loss to know where the problem still lies. Thanks for your patience, guys. Thanks! Edited March 10, 2008 by Diana (Cda)
Moderators SmOke_N Posted March 10, 2008 Moderators Posted March 10, 2008 (edited) Hard to believe you've been using AutoIt as long as you have. They are not dupilcates, because the 2nd dimension does have a Unique process identification number, if it's not necessary to have that number, then create your own Array unique function to handle 2 dimensional arrays or make the process name(s) into a 1 dimensional array and find my _ArrayUnique function in the search function (in the example forum).Edit:expandcollapse popup#include <array.au3> Local $aArray = _myProcessListFunc() _ArrayDisplay($aArray) Func _myProcessListFunc($sExe = "") Local $aPL, $sHold If $sExe Then $aPL = ProcessList($sExe) If $sExe = "" Then $aPL = ProcessList() _ArraySort($aPL, 0, 1, 0, 2) ;Create a 1 dim array for the names only: For $iCC = 1 To $aPL[0][0] $sHold &= $aPL[$iCC][0] & Chr(1) Next $sHold = StringSplit($sHold, Chr(1)) _ArrayUnique($sHold) Return $sHold EndFunc Func _ArrayUnique(ByRef $aArray, $vDelim = '', $iBase = 1, $iCase = 1) If Not IsArray($aArray) Then Return SetError(1, 0, 0) If $vDelim = '' Then $vDelim = Chr(01) Local $sHold For $iCC = $iBase To UBound($aArray) - 1 If Not StringInStr($vDelim & $sHold, $vDelim & $aArray[$iCC] & $vDelim, $iCase) Then _ $sHold &= $aArray[$iCC] & $vDelim Next If $sHold And $iBase = 1 Then $aArray = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim) Return SetError(0, 0, 0) ElseIf $sHold And $iBase = 0 Then Local $avArray = StringSplit(StringTrimRight($sHold, StringLen($vDelim)), $vDelim) ReDim $aArray[UBound($avArray) - 1] For $iCC = 1 To UBound($avArray) - 1 $aArray[$iCC - 1] = $avArray[$iCC] Next Return SetError(0, 0, 0) EndIf Return SetError(2, 0, 0) EndFunc Edited March 10, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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