Jump to content

Search the Community

Showing results for tags 'file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

Found 2 results

  1. So you want to files, huh? M'kay. Example code: import java.io.IOException; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "", info = "", logo = "", name = "Chicken Killer", version = 0) public class ChickenKiller extends Script { OSBotFileAPI osbotFile; String profile; @Override public void onStart() throws InterruptedException { initialiseCustomAPIs(); iWantToOpenAFile(); iWantToSaveStuffToAFile("Hello world!"); } private void initialiseCustomAPIs() { osbotFile = new OSBotFileAPI(); osbotFile.exchangeContext(bot); osbotFile.initializeModule(); } private void iWantToOpenAFile() { try { profile = osbotFile.open(); logger.debug(profile); } catch (RuntimeException | IOException e) { logger.error(e); } } private void iWantToSaveStuffToAFile(String stuff) { try { osbotFile.save("Hello world!"); } catch (RuntimeException | IOException e) { logger.error(e); } } @Override public int onLoop() throws InterruptedException { return 250; } } Testing: Folder is automatically created if it doesn't exist: I manually created a text file for testing and added it into the script data folder: I re-ran the script so that I could now select something: And then the script did a little save testing with the same file: Functions: public boolean folderExists() protected synchronized String readFromFile(File file) throws FileNotFoundException, IOException public synchronized String readFromFile(String filename) throws FileNotFoundException, IOException protected synchronized void writeToFile(File file, String fileContent) throws IOException public synchronized void writeToFile(String filename, String fileContent) throws IOException public synchronized String open(FileFilter fileFilter) throws RuntimeException, FileNotFoundException, IOException public synchronized String open() throws RuntimeException, FileNotFoundException, IOException public synchronized void save(FileFilter fileFilter, String fileContent) throws IOException public synchronized void save(String fileContent) throws IOException public synchronized boolean deleteFile(String filename) Source:
  2. Hey guys so i'm in the process of creating an auto muler for private use yet could do with some help. I've currently tried: Starting another client by running a batch file from a script (Doesn't work as OsBot won't allow the execution of a batch file) Sending a .txt file to a ftp which I will then read from, enabling my bots to communicate with each other. I'm using an FTP from a minecraft server I used to run (So I may not have permission to change everything but can still add/delete files) The problem is when I try to connect to the FTP to move a file I get this error I've added a grant to java.policy (Still no luck) grant { permission java.net.SocketPermission "localhost:0", "listen,resolve"; }; My current code is if (progress == 0) { log ("Attempting to call muleaaaa"); String ftpUrl = "ftp://%s:%s@%s/%s;type=i"; String host = ""; String user = ""; String pass = ""; String filePath = "file:/C:/Users/admin/OSBot/data/test.txt"; String uploadPath = "logs/test.txt"; ftpUrl = String.format(ftpUrl, user, pass, host, uploadPath); log("Upload URL: " + ftpUrl); try { URL url = new URL(ftpUrl); URLConnection conn = url.openConnection(); OutputStream outputStream = conn.getOutputStream(); FileInputStream inputStream = new FileInputStream(filePath); byte[] buffer = new byte[5]; int bytesRead = -1; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } inputStream.close(); outputStream.close(); log("File uploaded"); } catch (IOException ex) { ex.printStackTrace(); logger.error(ex); } As you can probably tell i'm not the most experienced in networking. Was just looking if anyone else has had this error (I've tried googling) If this is due to OsBot is a webserver (I'd have to look into how to do that) the next best way to set up an auto mule script? Thankyou!
×
×
  • Create New...