Jump to content

Search the Community

Showing results for tags 'script folder'.

  • 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. You can make your jar files copy themselves across to the OSBot script directory. This is mostly useful if you plan on giving someone your script in the form of a jar file, and you can try it out yourself with my Glassblowing script. Note: Nothing will happen if you try to run the jar file from within your script folder. The jar cannot delete itself. This is possible launching a batch process, but that's hacky and more effort than it's worth. When you export your project to a jar, make the code below your main class: Save as MoveToOSBotScriptFolder.java import java.awt.Desktop; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; /** * Move Jar file from wherever it currently is to OSBot's script folder. * * @author LiveRare * */ public class MoveToOSBotScriptFolder { public static final String OSBOT_SCRIPT_DIR = System.getProperty("user.home") + File.separatorChar + "osbot" + File.separatorChar + "scripts" + File.separatorChar; public static final File OSBOT_SCRIPT_FILE = new File(OSBOT_SCRIPT_DIR); public static final String THIS_FILE_DIR = MoveToOSBotScriptFolder.class.getProtectionDomain() .getCodeSource().getLocation().getFile().replaceAll("%20", " "); public static final File THIS_JAR_FILE = new File(THIS_FILE_DIR); public static final File OSBOT_SCRIPT_JAR_FILE = new File(OSBOT_SCRIPT_FILE, THIS_JAR_FILE.getName()); public static void main(String[] args) { try { if (!isRunningJarAlreadyInScriptsFolder()) { setSystemLAF(); if (alreadyExists() ? requestPermissionToOverwriteFile() : requestPermissionToMoveFile()) { if (deleteJarFileInScriptFolder() && createJarFileInScriptFolder()) { copyFileAcross(); openOSBotScriptFolder(); } } } } catch (IOException e) { e.printStackTrace(); } } private static boolean isRunningJarAlreadyInScriptsFolder() { return THIS_JAR_FILE.equals(OSBOT_SCRIPT_JAR_FILE); } private static void setSystemLAF() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } } private static boolean requestPermissionToMoveFile() { return JOptionPane.showConfirmDialog(null, String.format("Do you want to move:\n\n%s\n\nto\n\n%s", THIS_JAR_FILE, OSBOT_SCRIPT_FILE), "Confirm", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION; } private static boolean requestPermissionToOverwriteFile() { return JOptionPane.showConfirmDialog(null, String.format("%s already exists.\nDo you want to replace it?", OSBOT_SCRIPT_JAR_FILE.getName()), "Confirm", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION; } private static boolean alreadyExists() { return OSBOT_SCRIPT_JAR_FILE.exists() && OSBOT_SCRIPT_JAR_FILE.isFile(); } private static void copyFileAcross() throws FileNotFoundException, IOException { byte[] buffer = new byte[1024]; int length; try ( FileInputStream in = new FileInputStream(THIS_JAR_FILE); FileOutputStream out = new FileOutputStream(OSBOT_SCRIPT_JAR_FILE); ) { while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } } } private static boolean deleteJarFileInScriptFolder() { return !OSBOT_SCRIPT_JAR_FILE.exists() || OSBOT_SCRIPT_JAR_FILE.delete(); } private static boolean createJarFileInScriptFolder() throws IOException { return OSBOT_SCRIPT_JAR_FILE.exists() || OSBOT_SCRIPT_JAR_FILE.createNewFile(); } private static void openOSBotScriptFolder() { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(OSBOT_SCRIPT_FILE.toURI()); } } catch (IOException e) { e.printStackTrace(); } } }
  2. I have just started creating some very basic scripts, at first I was able to export them into my Osbot scripts folder, they'd show up in client and i could run them. Then somehow something broke and now only the local Woodcutter V- 0.1 shows even though I have 3 scripts in my script folder. Also if I remove the script that has the code for the Woodcutter it still stays in the Script Selector. So for example there will be GoblinKiller and Script1 in the Script folder and the Woodcutter will still show(it's named Script Update Tester in the folder in the screenshot) but it won't be runable. I've tried redownloading osbot, removing the osbot.jar build path and re-adding it but no luck. Has anyone had any similar issues? image of my situation -
×
×
  • Create New...