simson9900 Posted August 6, 2021 Share Posted August 6, 2021 Hello, I am trying to automate opening and killing OSBot processes in Windows by utilizing the ProcessBuilder library in Java 11. I can easily open OSBot using the cli with -login flagged, and keep the PID for future termination. The problem is that the OSBot login window opens for a second to log me in, to then open a new process that is the actual bot client. I therefore immediately lose the PID connection to the process. Any ideas how to work arround that? Kind regards Quote Link to comment Share on other sites More sharing options...
AtlassianTarsier Posted December 24, 2022 Share Posted December 24, 2022 (edited) wmic process Where "CommandLine Like '%oempaloempa%'" Call Terminate Replace oempaloempa with the runescape account name. So it will look for the command that was started containing that runescape account name :)! Took me a while to find a solution for this problem.. Edited December 24, 2022 by AtlassianTarsier Quote Link to comment Share on other sites More sharing options...
BloodyNoah Posted September 24 Share Posted September 24 You could try using a ProcessHandle to get a handle to the child process after launching the main OSBot process. Once the login window opens, you can listen for the new process to spawn and grab its PID. A simple way to achieve this is to use a loop to check for active processes after starting OSBot. Another option is to use a library like JNA to interact with the Windows API, which might give you better control over the processes. Quote Link to comment Share on other sites More sharing options...