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.

Is it possible to run a bat file from inside a script?

Featured Replies

This may be an absolutely stupid question to some people, but i honestly don't know. Is it possible to run a bat file from inside an osbot script? If so, how? 

 

If its not possible, how would i go about starting another script when my player is in a certain area (without stopping the original script). 

 

Thanks.

  • Author

Should be possible in Java, don't know if OSBot allows it tho.

http://bfy.tw/8hes

Hmm, i'm trying to write a muling script and my ideal way of doing it was starting a CLI bat file from within the script. I've tried a few different methods but they all so far don't work for one reason or another;

Process p =  Runtime.getRuntime().exec("cmd /c mule.bat", null, new File("C:\\Users\\Plague Doctor\\Desktop\\mule"));

 

Hmm, i'm trying to write a muling script and my ideal way of doing it was starting a CLI bat file from within the script. I've tried a few different methods but they all so far don't work for one reason or another;

Process p =  Runtime.getRuntime().exec("cmd /c mule.bat", null, new File("C:\\Users\\Plague Doctor\\Desktop\\mule"));

Check the logger, could be that OSBot blocks it due to security.

  • Author

Check the logger, could be that OSBot blocks it due to security.

Haven't got that far yet, still stuck at getting the code to not have errors :P

Put mule.bat file inside C:/users/%USERNAME%/OSBot/mule/mule.bat    

 

 String filePath = "C:/users/%USERNAME%/OSBot/mule/mule.bat";
        try {
            
            Process p = Runtime.getRuntime().exec(filePath);
            
        } catch (Exception e) {
            e.printStackTrace();
        }

Yeah no.

 

Please post your batch script and explain accurately what you're trying to achieve, I have a feeling you're 100% on the wrong track.

This may be an absolutely stupid question to some people, but i honestly don't know. Is it possible to run a bat file from inside an osbot script? If so, how? 

 

If its not possible, how would i go about starting another script when my player is in a certain area (without stopping the original script). 

 

Thanks.

 

If you want to start another script you can do:

List<String> command = new ArrayList<>();

Collections.addAll(command, "java", "-jar", "C:\\Path\\To\\OSBot.jar");
Collections.addAll(command, "-login", "username:password");

// add all the other parameters like above

ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.start();

You can check out the source of my OSBot Manager to see how I did it:

 

https://github.com/Explv/osbot_manager/blob/master/src/script_executor/ScriptExecutor.java

 

 

If you really want to store it in a .bat file then you can do the same as above but replacing the command with:

List<String> command = new ArrayList<>();

Collections.addAll(command, "cmd", "/c", "start");
command.add("C:\\Path\\To\\.bat");

Edited by Explv

  • Author

 

If you want to start another script you can do:

List<String> command = new ArrayList<>();

Collections.addAll(command, "java", "-jar", "C:\\Path\\To\\OSBot.jar");
Collections.addAll(command, "-login", "username:password");

// add all the other parameters like above

ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.start();

You can check out the source of my OSBot Manager to see how I did it:

 

https://github.com/Explv/osbot_manager/blob/master/src/script_executor/ScriptExecutor.java

 

 

If you really want to store it in a .bat file then you can do the same as above but replacing the command with:

List<String> command = new ArrayList<>();

Collections.addAll(command, "cmd", "/c", "start");
command.add("C:\\Path\\To\\.bat");

[ERROR][bot #1][11/12 01:53:29 AM]: Blocked permission: ("java.io.FilePermission" "<<ALL FILES>>" "execute")

 

Seems like the way im doing it isnt allowed :kappa:

[ERROR][bot #1][11/12 01:53:29 AM]: Blocked permission: ("java.io.FilePermission" "<<ALL FILES>>" "execute")

Seems like the way im doing it isnt allowed :kappa:

Indeed, I expected that OSBot would prevent you from executing files like that. Im not sure if there is a -allow CLI parameter for allowing such things, but I doubt it. You will need to figure out an alternative solution for muling :)

For example you could write a server that listens on a socket, when it receives a message from your script it runs the muling script

Edited by Explv

  • Author

Indeed, I expected that OSBot would prevent you from executing files like that. Im not sure if there is a -allow CLI parameter for allowing such things, but I doubt it. You will need to figure out an alternative solution for muling smile.png

For example you could write a server that listens on a socket, when it receives a message from your script it runs the muling script

Thanks for the example, sounds like something very useful to learn. Looking into it now.

Thanks for the example, sounds like something very useful to learn. Looking into it now.

Take a look at the ServerSocket and Socket classes, there are plenty of examples online

  • 3 weeks later...

So, if I understood correctly, OSbot blocks the execute command

Blocked permission: ("java.io.FilePermission" "<<ALL FILES>>" "execute")

So there's no way to init a new Osbot client from within the script  without having some outer program/listener?

So, if I understood correctly, OSbot blocks the execute command

Blocked permission: ("java.io.FilePermission" "<<ALL FILES>>" "execute")

So there's no way to init a new Osbot client from within the script  without having some outer program/listener?

 

Correct

What i did for my mules was actually send a private message or clan chat which would start the other bot ;)

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.