January 9, 20214 yr Hi, Going to FM19, I'm updating some old plugin and I need to know if an application is running or not on the client PC. I used Moo Plug for years and it work https://mooplug.com/docs/functions/moo_processrunning ** Edit: A new x64 version is on the way, Adam send me a beta version ** I'm trying this code try { String line; Process p = Runtime.getRuntime().exec (System.getenv("windir") +"\\system32\\"+"tasklist.exe"); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); //<-- Parse data here. } input.close(); } catch (Exception err) { err.printStackTrace(); } I know nothing about Java or Groovy, but it look like it's sending data in the "while" one by one and at the end the input.close flush the result and I get nothing ?!?! So from the return value I could test if my process is running or not. If someone could shed some light, it will be appreciated. Thanks Edited January 10, 20214 yr by JF Fortier
January 10, 20214 yr Author By reversing engineering many script and code on the web, I wrote the script like this and it return what I need to have, so for anyone looking to get the list of all running process on windows, use it freely 😁 TaskList = '' Process p = Runtime.getRuntime().exec (System.getenv("windir") +"\\system32\\"+"tasklist.exe /nh " ) BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { TaskList = TaskList + line + '\n' } return TaskList Edited January 10, 20214 yr by JF Fortier
January 10, 20214 yr Author Using this will only bring the process name in a list, no more useless data TaskList = '' Process p = Runtime.getRuntime().exec (System.getenv('windir') +'\\system32\\' + 'tasklist.exe /nh /fo csv' ) BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { line = Eval.me('[' + line + ']') TaskList += line.get(0) + '\n' } return TaskList Edited January 10, 20214 yr by JF Fortier
Create an account or sign in to comment