AlexFing17 Posted May 13, 2017 Share Posted May 13, 2017 Please what am i doing wrong here.\ I want my program to call a function with the process name i write in the script is the same as the name in process list. if is the same name then it gives a message , if not then it gives a message that it is not. I will compile it and save it as test.exe if the process name in the script should be the name running in process list then it tells me "the name matches" if not then it tells me "the name doesnt math" please any help? #include <MsgBoxConstants.au3> #include <Process.au3> Local $iPid = WinGetProcess("test.exe", "") Local $sName = _ProcessGetName($iPid) if $sName then MsgBox($MB_SYSTEMMODAL,"Box", "The name match the process name" ) Else MsgBox($MB_SYSTEMMODAL,"Box", "The name doesnt match the process name" ) endif Link to comment Share on other sites More sharing options...
Subz Posted May 13, 2017 Share Posted May 13, 2017 So does your test.exe have a window and is the title named test.exe? Can you post the test.au3 file? AlexFing17 1 Link to comment Share on other sites More sharing options...
FengHuangWuShen Posted May 13, 2017 Share Posted May 13, 2017 (edited) #Include <Process.au3> Instance_Check() Func Instance_Check() Local $PROCESS_LIST = ProcessList('SomeProcess.exe') For $i = 1 To $PROCESS_LIST[0][0] ConsoleWrite($PROCESS_LIST[$i][0] & ' [' & $PROCESS_LIST[$i][1] & ']' & @CRLF) Next EndFunc Result: SomeProcess.exe [PID] $PROCESS_LIST[$i][0] ; This returns the process name *.exe $PROCESS_LIST[$i][1] ; This returns the process ID Example use: #Include <Process.au3> Instance_Check() Func Instance_Check() Local $PROCESS_LIST = ProcessList('Chrome.exe') For $i = 1 To $PROCESS_LIST[0][0] ConsoleWrite($PROCESS_LIST[$i][0] & ' [' & $PROCESS_LIST[$i][1] & ']' & @CRLF) If $PROCESS_LIST[$i][0] = 'Chrome.exe' Then ExitLoop Else ContinueLoop Endif Next Other_Func() EndFunc Func Other_Func() ConsoleWrite('Process Found!' & @CRLF) EndFunc Result: chrome.exe [54524] Process Found! Edited May 13, 2017 by FengHuangWuShen 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