Bueno necesitaba obtener el PID de un proceso sabiendo solo el nombre de este y salio esto, se podría hacer de otra forma mejor pero no me salia de otra forma.
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author: Naker90

 Script Function:
	Obtiene el PID de un proceso sabiendo su nombre
	
Ejemplo de uso 
	Msgbox(64, '', Find_PID_By_Name('explorer.exe'))  ==> retorna el Process ID de explorer.exe
	
#ce ----------------------------------------------------------------------------

Func Find_PID_By_Name($sProcess_Name)

	sShell($sProcess_Name)

	Local $sPID = FileRead(@TempDir & '\PID.txt')
	Local $sArray = StringSplit($sPID, ' ')

	FileDelete(@TempDir & '\PID.txt')

	Return $sArray[19]
EndFunc   ;==>FindPIDByName

Func sShell($sName)

	Local $sCMD = 'tasklist | find ' & '"' & $sName & '"' & '>PID.txt'

	Run('"' & @ComSpec & '" /k ' & $sCMD, @TempDir, @SW_HIDE)

EndFunc   ;==>sShell
Saludos
Skype: naker.noventa
Gracias por la función. aunque me parece algo cutre con el potencial y funcionalidad de autoit.

mira

msgbox(0,"",Get_PID_byName("Explorer.exe"))

Func Get_PID_byName($Name)
local $PID=0
$PID=ProcessExists($Name)
if $PID then Return $PID
EndFunc


saludos
Imagen
Pink escribió:Gracias por la función. aunque me parece algo cutre con el potencial y funcionalidad de autoit.

mira

msgbox(0,"",Get_PID_byName("Explorer.exe"))

Func Get_PID_byName($Name)
local $PID=0
$PID=ProcessExists($Name)
if $PID then Return $PID
EndFunc


saludos
No tenia ni idea del ProcessExist, así esta mucho mejor. Gracias Pink
Saludos
Skype: naker.noventa
Joder, se me adelanto Pink.

Yo tambien lo hago con ProcessExist.
Func sGetPID($sProcessName)
    $sPID = ProcessExists($sProcessName)

	If $sPID = 0 Then
	    Return "Unknown"
	Else
		Return $sPID
	EndIf
EndFunc
//Regards.
Ikarus: Backdoor.VBS.SafeLoader
Agnitum: Trojan.VBS.Safebot.A
http://indeseables.github.io/
Responder

Volver a “Fuentes”