November 11, 20169 yr 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.
November 11, 20169 yr Should be possible in Java, don't know if OSBot allows it tho. http://bfy.tw/8hes
November 11, 20169 yr 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"));
November 11, 20169 yr 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.
November 11, 20169 yr 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
November 11, 20169 yr 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(); }
November 11, 20169 yr 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.
November 11, 20169 yr 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, 20169 yr by Explv
November 11, 20169 yr 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
November 11, 20169 yr [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, 20169 yr by Explv
November 11, 20169 yr 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 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.
November 11, 20169 yr 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
November 27, 20169 yr 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?
November 27, 20169 yr 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
November 27, 20169 yr 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