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.

Ability to interact/start and stop scripts on the client from a different program

Featured Replies

I would like to make a program that has the ability to send a request to the osbot client to stop its current script and start a new one. I just want to build a custom script manager.

 

Is this something osbot supports? Could not find anything. I see that there is the script queue and the osbot manager, but I want to be able to write some custom code in my own program.

  • Author
6 hours ago, Khaleesi said:

I don't think that's possible :)

Thanks for the reply! Love your scripts! I think I will have to start making my own, I will probably try to make a simple HTTP server or read a file inside the script so another program can communicate with it.

12 hours ago, JavaMadness said:

I would like to make a program that has the ability to send a request to the osbot client to stop its current script and start a new one. I just want to build a custom script manager.

 

Is this something osbot supports? Could not find anything. I see that there is the script queue and the osbot manager, but I want to be able to write some custom code in my own program.

I accomplished this with a little bit of help from my assistant, ChatGPT. Here is a java program that will launch a jar using only the java.io package.

import java.io.*;

class JarLauncher {
    public static void main(String[] args) {
        Process jarProcess = null;

        try {
            // Define the directory path without the JAR file name
            String directoryPath = "FILE_PATH_TO_YOUR_OSBOT.JAR_FILE";

            // Set the working directory to the correct directory and launch the osbot.jar jar file (rename if needed)
            ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", "osbot.jar",
                    "-login", "osbot_username:osbot_password",
                    "-bot", "account_name:account_password:0000",
                    "-script", "Extra House Favour:hosidius_1"
            );
            processBuilder.directory(new File(directoryPath));

            // Start the process
            jarProcess = processBuilder.start();

            // Capture the process output for logging
            BufferedReader reader = new BufferedReader(new InputStreamReader(jarProcess.getInputStream()));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }

            // Count the seconds
            int seconds = 0;

            // Run the Java program for 3 seconds
            while (seconds < 3) {
                // Wait for 1 second
                Thread.sleep(1000);

                seconds++;
                System.out.println("Running for " + seconds + " seconds.");
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        } finally {
            if (jarProcess != null) {
                try {
                    // Terminate the JAR process
                    jarProcess.destroy();
                    int exitCode = jarProcess.waitFor();
                    System.out.println("JAR process exited with code: " + exitCode);

                    // Optionally, use taskkill to forcefully terminate the JAR process
                    String os = System.getProperty("os.name").toLowerCase();
                    if (os.contains("win")) {
                        Runtime.getRuntime().exec("taskkill /F /IM java.exe");
                    }
                } catch (IOException | InterruptedException e) {
                    e.printStackTrace();
                }
            }

            // Exit the Java application when done
            System.exit(0);
        }
    }
}
  • Author
5 hours ago, ExtraBotz said:

I accomplished this with a little bit of help from my assistant, ChatGPT. Here is a java program that will launch a jar using only the java.io package.

 

Thanks! It looks like this is only to read the logs, and to control the exit of the program. I am looking more for controlling the script running without exiting the program.

3 hours ago, JavaMadness said:

Thanks! It looks like this is only to read the logs, and to control the exit of the program. I am looking more for controlling the script running without exiting the program.

This is a work around because what you want isn't offered by the OSBot API. You can modify the method to be used repeatedly then run infinite instances through cli to launch any script. Theoretically you could just create a script and implement the same code that launches other instances of OSBot. This could be done on the same account.

Depending on what you want to do it sounds like you may be better off using CLI in your scripts and adding them to the bot manager. For example if the argument is "1" you would do task 1 until exit. On exit the bot manager would run the next task based on CLI arguments so you can go from task 1 -> 2 -> ...

You can learn more here (this tutorial was written before bot manager existed): 

 

  • Author
On 10/23/2023 at 9:26 PM, ExtraBotz said:

Depending on what you want to do it sounds like you may be better off using CLI in your scripts and adding them to the bot manager. For example if the argument is "1" you would do task 1 until exit. On exit the bot manager would run the next task based on CLI arguments so you can go from task 1 -> 2 -> ...

Yes I am using the old explv osbot manager and that is what it does. I was also thinking about having a script that does this two way communication through the file system or through a server. 

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.