Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

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.

Question about tracking osbot PID

Featured Replies

Hi All,

My automuling system tracks each osbot client PID as it opens and then task kills the client when it is time to mule. However this seems to be only working about 75% of the time now - the rest of the time i am getting    "ERROR: The process "XXXX" is not found". This is probably a dumb question but does the OSbot PID change, or am i just pulling a wrong PID?

 

Thanks :)

23 minutes ago, throwaway1237843 said:

Hi All,

My automuling system tracks each osbot client PID as it opens and then task kills the client when it is time to mule. However this seems to be only working about 75% of the time now - the rest of the time i am getting    "ERROR: The process "XXXX" is not found". This is probably a dumb question but does the OSbot PID change, or am i just pulling a wrong PID?

 

Thanks :)

How are you starting the OSBot processes and getting the PIDs? show your code 

And no, the PID of a given process does not change throughout that process' lifetime.

Edited by Explv

  • Author

 

This is where I pull all the java PIDs before starting up a client. This goes into a list, then I open a new client, pull all the PIDS again, compare the two lists and extract the new value. Bots are started with CLI also

Edited by throwaway1237843

  • Author
java -jar "C:\Users\XXXX\Downloads\osbot 2.5.22.jar" -login XXXXX:XXXXXX -bot %mule% -script "Automuler-reciever_dye":null -proxy %muleproxy% -world 326 -allow lowresource

example of my launcher

26 minutes ago, throwaway1237843 said:

This is where I pull all the java PIDs before starting up a client. This goes into a list, then I open a new client, pull all the PIDS again, compare the two lists and extract the new value. Bots are started with CLI also

OK that's fine, probably what isn't working for you is the fact that OSBot starts two processes.

The first process is the boot menu where you type your login details. When you click login, a new process is started for the actual client, and the boot menu process exits.

For example:

# Boot menu opens
C:\Users\Explv>tasklist /FI "IMAGENAME eq java.exe" /NH
java.exe                      5304 Console                    2     51,772 K

# Client opens
C:\Users\Explv>tasklist /FI "IMAGENAME eq java.exe" /NH
java.exe                     15692 Console                    2     37,620 K



You have two options:

1. Add a sleep long enough to let OSBot boot up properly and for the client to open, and then get the PIDs

or

2 (recommended) Use Python/Java/Whatever programming language to run OSBot (in debug mode) and read the output. When the output contains "Successfully loaded OSBot!" you know that the client has fully booted and you can get the PID using tasklist. Here is an example I wrote in Java https://github.com/Explv/osbot_manager/blob/master/osbot_manager/src/bot_parameters/configuration/Configuration.java#L347

Edited by Explv

  • Author
2 minutes ago, Explv said:

OK that's fine, probably what isn't working for you is the fact that OSBot starts two processes.

The first process is the boot menu where you type your login details. When you click login, a new process is started for the actual client, and the boot menu process exits.

For example:


# Boot menu opens
C:\Users\Explv>tasklist /FI "IMAGENAME eq java.exe" /NH
java.exe                      5304 Console                    2     51,772 K

# Client opens
C:\Users\Explv>tasklist /FI "IMAGENAME eq java.exe" /NH
java.exe                     15692 Console                    2     37,620 K



You have two options:

1. Add a sleep long enough to let OSBot boot up properly and for the client to open, and then get the PIDs

or

2 (recommended) Use Python/Java/Whatever programming language to run OSBot (in debug mode) and read the output. When the output contains "OSBot is now ready!" you know that the client has fully booted and you can get the PID using tasklist. Here is an example I wrote in Java https://github.com/Explv/osbot_manager/blob/master/osbot_manager/src/bot_parameters/configuration/Configuration.java#L347

Ah okay, I will play around with that. Thank you!!!

24 minutes ago, throwaway1237843 said:

Ah okay, I will play around with that. Thank you!!!

Here is another example using Python:
 

import subprocess

OSBOT_PATH = "C:\\Users\\Explv\\Downloads\\OSBot 2.5.22.jar"
OSBOT_USER = ""
OSBOT_PASS = ""


def main():
    cmd = ["java", "-jar", OSBOT_PATH, "-login", OSBOT_USER + ":" + OSBOT_PASS, "-debug"]

    popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)

    prev_pids = get_java_pids()
    
    for stdout_line in iter(popen.stdout.readline, ""):
        print(stdout_line)
        if "Successfully loaded OSBot!" in stdout_line:
            break
    popen.stdout.close()

    new_pids = get_java_pids()

    current_osbot_pid = new_pids - prev_pids
    
    if len(current_osbot_pid) > 1:
        raise ValueError('More than one new Java PID found')

    print("OSBot PID is: " + next(iter(current_osbot_pid)))

def get_java_pids():
    pids = set()
    java_processes = subprocess.check_output("tasklist /FI \"IMAGENAME eq java.exe\" /NH")
    for java_process in java_processes.decode('utf-8').splitlines():
        if len(java_process.strip()) > 0:
            pid = java_process.split()[1]
            pids.add(pid)

    return pids

if __name__ == '__main__':
    main()
        

 

Edited by Explv

  • Author

Actually it turns out the problem is if my PID is 5 digits the first digit is getting chopped off when i extract it ?. Now just need to figure out why lol

 

edit: just needed to delete !PIDS:~1,-1!, and added a small sleep :) Thanks!

Edited by throwaway1237843

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.