eracross Posted September 3, 2011 Share Posted September 3, 2011 What i want is to close all process with "name+any numbers.exe" like name1.exe, name2.exe. $check = ProcessExists("name*.exe") ProcessClose($check) but not working any other way to do that?Sry for my bad english. Link to comment Share on other sites More sharing options...
Malkey Posted September 4, 2011 Share Posted September 4, 2011 This may help you. Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") Local $sString = "name" Local $list = ProcessList() For $i = 1 To $list[0][0] If StringRegExp($list[$i][0], "^note.*$") Then ProcessClose($list[$i][0]) ;If StringRegExp($list[$i][0], "^" & $sString & "\d+\.exe$") Then ProcessClose($list[$i][0]) Next ; Note - ".*" in RE pattern, "." matches any character, and "*" causes the previous ; character to be matched if repeated zero or many times. ; "^" means beginning of string. ; "$" means end of string. So using both "^" an "$" causes the entire string ; to be compared, and not a matching sub-string. ; StringRegExp() default parameter flag is zero which causes the return value ; to be 1 or 0 only. ; Regular expression are like an advanced evolved version of wildcards. ; ; To match "name+any numbers.exe" like name1.exe, name2.exe, try the RE pattern ; "^" & $sString & "\d+\.exe$", where $sString contains "name" 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