Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Get Window running process

Featured Replies

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 by JF Fortier

  • 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 by JF Fortier

  • 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 by JF Fortier

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.