PlagueDoctor Posted November 11, 2016 Share Posted November 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
Rudie Posted November 11, 2016 Share Posted November 11, 2016 Should be possible in Java, don't know if OSBot allows it tho. http://bfy.tw/8hes Quote Link to comment Share on other sites More sharing options...
PlagueDoctor Posted November 11, 2016 Author Share Posted November 11, 2016 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")); Quote Link to comment Share on other sites More sharing options...
Rudie Posted November 11, 2016 Share Posted November 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
PlagueDoctor Posted November 11, 2016 Author Share Posted November 11, 2016 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 Quote Link to comment Share on other sites More sharing options...
Zappster Posted November 11, 2016 Share Posted November 11, 2016 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(); } 1 Quote Link to comment Share on other sites More sharing options...
Botre Posted November 11, 2016 Share Posted November 11, 2016 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. Quote Link to comment Share on other sites More sharing options...
Explv Posted November 11, 2016 Share Posted November 11, 2016 (edited) 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 November 11, 2016 by Explv 1 Quote Link to comment Share on other sites More sharing options...
PlagueDoctor Posted November 11, 2016 Author Share Posted November 11, 2016 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 Quote Link to comment Share on other sites More sharing options...
Explv Posted November 11, 2016 Share Posted November 11, 2016 (edited) [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 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 November 11, 2016 by Explv Quote Link to comment Share on other sites More sharing options...
PlagueDoctor Posted November 11, 2016 Author Share Posted November 11, 2016 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 Thanks for the example, sounds like something very useful to learn. Looking into it now. Quote Link to comment Share on other sites More sharing options...
Explv Posted November 11, 2016 Share Posted November 11, 2016 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 1 Quote Link to comment Share on other sites More sharing options...
Butters Posted November 27, 2016 Share Posted November 27, 2016 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? Quote Link to comment Share on other sites More sharing options...
Explv Posted November 27, 2016 Share Posted November 27, 2016 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 Quote Link to comment Share on other sites More sharing options...
dmmslaver Posted November 27, 2016 Share Posted November 27, 2016 What i did for my mules was actually send a private message or clan chat which would start the other bot ;) Quote Link to comment Share on other sites More sharing options...