- Offizieller Beitrag
Hallo!
So. Wider mal ein Skript von mir Diemal liest er ein paar informationen aus von allen momentan aktiven Processen! Er liest den ProcessName, die Process ID, den Pfad der Process Exe, den Titel des Processes (falls vorhanden) und dir "ID" (HWnd) des titels (falls vorhanden)
Mit Doppelklick wird das angeklickte Item in die Zwischenablage kopiert.
naja.. hier das skript:
Spoiler anzeigen
#include<GuiListView.au3>
#include<GUIConstantsEx.au3>
#include<WindowsConstants.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,$abbort = 0
[/autoit] [autoit][/autoit] [autoit]GUICreate("Process Informations - By GtaSpider", 516, 235, 193, 115,$WS_SIZEBOX)
[/autoit] [autoit][/autoit] [autoit]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,245,25)
GUICtrlSetResizing(-1,576)
$CloseBut = GUICtrlCreateButton("Process &Kill",257,180,245,25)
GUICtrlSetResizing(-1,576)
GUISetState(@SW_SHOW)
_List()
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ListView
_GUICtrlListView_SortItems($ListView, 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()
Case $CloseBut
$lvtodel = GuiCtrlRead($ListView)
$read = StringSplit(GUICtrlRead(GuiCtrlRead($ListView)),"|")
HotKeySet("{ESC}","_abbort")
For $i = 30 To 0 Step -1
If $abbort Then ExitLoop
Sleep(100)
$round = Round($i/10,1)
If StringLen($round) = 1 Then $round &= ".0"
TrayTip("Countdown","In "&$round&" Seconds will "&$read[1]&" Close!"&@CRLF&"Pess [ESC] to Abbort!",2,2)
Next
TrayTip("","",1)
HotKeySet("{ESC}")
If $abbort Then
$abbort = 0
ContinueLoop
EndIf
ProcessClose($read[2])
$i = 0
While ProcessExists($read[2])
Sleep(100)
ProcessClose($read[2])
$i+=1
If $i = 10 Then ExitLoop
WEnd
If ProcessExists($read[2]) Then
MsgBox(16,"Process Information","I can't close "&$read[1]&" ["&$read[2]&"] !")
GUICtrlSetBkColor($lvtodel,0xaa0000)
Else
GUICtrlDelete($lvtodel)
EndIf
EndSwitch
WEnd
Exit
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _abbort()
$abbort = 1
EndFunc
Func _List()
_GUICtrlListView_DeleteAllItems($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
_GUICtrlListView_SetColumnWidth($ListView,0,80)
_GUICtrlListView_SetColumnWidth($ListView,1,40)
_GUICtrlListView_SetColumnWidth($ListView,2,150)
_GUICtrlListView_SetColumnWidth($ListView,3,130)
_GUICtrlListView_SetColumnWidth($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 Spider
Edit: So! Jetzt kann man den Process Schließen! Danke für die idee, waluev
Edit2: Für AutoIt Version 3.2.10.0 und höher Optimiert.