Advertisement
Leka74

System.EndProcess

Mar 24th, 2011
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. -- With this function you can end (terminate) a process easily by just typing the name of the process in the function.
  2.  
  3. -- The function
  4. function System.EndProcess(strProcess)
  5.     strProcess = String.Lower(strProcess);
  6.     tblProcesses = System.EnumerateProcesses();
  7.     for i, strPath in pairs(tblProcesses) do
  8.         local strFile = String.SplitPath(strPath);
  9.         if (String.Lower(strFile.Filename..strFile.Extension)) == strProcess then
  10.             System.TerminateProcess(i);
  11.         end
  12.     end
  13. end
  14.  
  15. -- An example
  16. System.EndProcess("itunes.exe")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement