GtaSpider Posted January 16, 2007 Share Posted January 16, 2007 Hello! Oh.. it isnt a very great thing, too! (damn i must create greater things ) But its useful i think! You'll get infos from all running processes! You'll get the Process Name, the Process ID, the Path to the Process exe, the Window title (if it gaves one!) and the HWnd ("ID" of window) (if it gave one..) ok.... heres the script : expandcollapse popup#include <GUIConstants.au3> #include <GUIListView.au3> ;By GtaSpider ;This Script get you informations of all Process! ;*You can Sort it. ;*You can put it to clipboard if you doubleclick on the item ;*You can see the exeName, the ProcessID, the Path, the Title and the HWND. Global $mousespeed = RegRead("HKCU\Control Panel\Mouse", "DoubleClickSpeed"),$start = 0,$diff = 0,$doubleclicked = 0,$color = 1 GUICreate("Process Informations - By GtaSpider", 516, 235, 193, 115,$WS_SIZEBOX) GUISetBkColor(0x000000) $ListView = GUICtrlCreateListView("Process|ID|Path|Title|HWND", 8, 8, 494, 150) GUICtrlSetTip(-1,"DoubleClick to save it on the ClibBoard.") GUICtrlSetResizing(-1,102) $Progress = GUICtrlCreateProgress(8, 160, 494, 17) ;~ GUICtrlSetResizing(-1,512) GUICtrlSetResizing(-1,576) $RefBut = GUICtrlCreateButton("Refresh",8,180,494,25) GUICtrlSetResizing(-1,576) GUISetState(@SW_SHOW) Global $B_DESCENDING[_GUICtrlListViewGetSubItemsCount($ListView) ] _List() _GUICtrlListViewSort($ListView, $B_DESCENDING, 0) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ListView _GUICtrlListViewSort($ListView, $B_DESCENDING, GUICtrlGetState($ListView)) Case $GUI_EVENT_PRIMARYDOWN $diff = TimerDiff($start) If $mousespeed = "" Then $mousespeed = 500 If $diff < $mousespeed And $doubleclicked = 0 Then $itemclicked = GUICtrlRead($ListView) If $itemclicked > 0 Then $read = GuiCtrlRead($itemclicked) $read = StringSplit($read,"|") $clipput = "Process Name: "&$read[1]&@CRLF & _ "Process ID: "&$read[2]&@CRLF & _ "Path to Process exe: "&$read[3]&@CRLF & _ "Title of Process: "&$read[4]&@CRLF & _ "HWND of Process: "&$read[5] ClipPut($clipput) TrayTip("Process Informations - By GtaSpider",$read[1]&" saved to Clipboard! You can read it with CTRL+V.",4) EndIf $doubleclicked = 1 Else $doubleclicked = 0 EndIf $start = TimerInit() Case $RefBut _List() EndSwitch WEnd Exit Func _List() _GUICtrlListViewDeleteAllItems($ListView) $pl = ProcessList() For $i = 1 To $pl[0][0] GUICtrlSetData($Progress,(100*$i)/$pl[0][0]) $getPath = _PidGetPath($pl[$i][1]) $getTitle = _WinGetInfoByPID($pl[$i][1]) If IsArray($getTitle) Then $tmp_list = GUICtrlCreateListViewItem($pl[$i][0] & "|" & $pl[$i][1] & "|" & $getPath & "|" & $getTitle[1][1] & "|" & $getTitle[1][2], $ListView) Else $tmp_list = GUICtrlCreateListViewItem($pl[$i][0] & "|" & $pl[$i][1] & "|" & $getPath & "|-|-", $ListView) EndIf GUICtrlSetColor($tmp_list,0xffffbb) If $color Then $color = 0 GUICtrlSetBkColor($tmp_list,0x0000aa) Else $color = 1 GUICtrlSetBkColor($tmp_list,0x000088) EndIf Next _GUICtrlListViewSetColumnWidth($ListView,0,80) _GUICtrlListViewSetColumnWidth($ListView,1,40) _GUICtrlListViewSetColumnWidth($ListView,2,150) _GUICtrlListViewSetColumnWidth($ListView,3,130) _GUICtrlListViewSetColumnWidth($ListView,4,70) EndFunc ;==>_List Func _PidGetPath($pid = "", $strComputer = 'localhost') If $pid = "" Then $pid = WinGetProcess(WinGetTitle("")) $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Process WHERE ProcessId = " & $pid, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $objItem.ExecutablePath Then Return $objItem.ExecutablePath Next EndIf EndFunc ;==>_PidGetPath Func _WinGetInfoByPID($sPID) Local $aPList = ProcessList(), $iPID For $iiCount = 1 To $aPList[0][0] If $aPList[$iiCount][1] = $sPID Then If $sPID = 0 Then Return 0 $iPID &= $aPList[$iiCount][1] & Chr(01) EndIf Next $iPID = StringSplit($iPID, Chr(01)) If $iPID = 0 Then Return SetError(1, 0, 0) Local $aStoreHwndAndText[2][9], $nCount = 1 $OptWSC = Opt('WinSearchChildren', 1) $OptWDHT = Opt('WinDetectHiddenText', 1) Local $aWinList = WinList() For $iCount = 1 To $aWinList[0][0] For $xCount = 1 To $iPID[0] If WinGetProcess($aWinList[$iCount][1]) = $iPID[$xCount] And _ $aWinList[$iCount][0] <> '' Then Local $aWinPos = WinGetPos($aWinList[$iCount][1]) Local $aWinClient = WinGetClientSize($aWinList[$iCount][1]) $nCount += 1 ReDim $aStoreHwndAndText[$nCount][9] $aStoreHwndAndText[$nCount - 1][1] = $aWinList[$iCount][0] $aStoreHwndAndText[$nCount - 1][2] = $aWinList[$iCount][1] $aStoreHwndAndText[$nCount - 1][3] = WinGetText($aWinList[$iCount][1]) $aStoreHwndAndText[$nCount - 1][4] = $aWinPos[0] $aStoreHwndAndText[$nCount - 1][5] = $aWinPos[1] $aStoreHwndAndText[$nCount - 1][6] = $aWinClient[0] $aStoreHwndAndText[$nCount - 1][7] = $aWinClient[1] $aStoreHwndAndText[$nCount - 1][8] = WinGetClassList($aWinList[$iCount][1]) EndIf Next Next Opt('WinSearchChildren', $OptWSC) Opt('WinDetectHiddenText', $OptWDHT) If $nCount = 1 Then Return SetError(2, 0, 0) Return $aStoreHwndAndText EndFunc ;==>_WinGetInfoByPID Mfg / Bestr regards Spider www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2007 Moderators Share Posted January 16, 2007 "Process Informations - By GtaSpider"Ahem...So, you wrote the function _WinGetInfoByPID() and _PIDGetPath()? 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. Link to comment Share on other sites More sharing options...
jaenster Posted January 17, 2007 Share Posted January 17, 2007 I got a error from object -jaenster Link to comment Share on other sites More sharing options...
GtaSpider Posted January 17, 2007 Author Share Posted January 17, 2007 (edited) Ahem...So, you wrote the function _WinGetInfoByPID() and _PIDGetPath()?No i don't! But ived think that now all of you here that you written it! but ok.. if you mean!Thanks to SmOke_N and Gary for functions.@jaenster: what for a error? have you got the newest autoit (3.2.2.0) ?spiderEdit: added point and gary Edited January 17, 2007 by GtaSpider www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 17, 2007 Moderators Share Posted January 17, 2007 No i don't! But ived think that now all of you here that you written it! but ok.. if you mean!Thanks to SmOke_N for functions@jaenster: what for a error? have you got the newest autoit (3.2.2.0) ?spiderHa... I love the boldness! But you missed the point .P.S.I didn't write the _PidGetPath() function, last I remember, Gary introduced that method, I used to use Lars method with calling the kernel32.dll until that one. 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. 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