TheScrub Posted August 20, 2013 Share Posted August 20, 2013 (edited) Hey if you use this method and release the script leave an accreditation i release these snippets for the community... first we need to create a void like soo with a file name and the settings you want to it to save to an ".txt" file public void writeConfigSettings(String FileName,String... settings) throws IOException { Constructing the file writer and the exact name,location of the file // thanks to lackofchesee from TS3 for the path name! FileWriter f = new FileWriter(System.getProperty("user.home") + File.separator + "OSBot" + File.separator + "data" + File.separator + FileName +".txt"); // writing to an exact path to the osbot data folder also constructing a FileWriter Running the settings though a for loop to get a single setting then writing it to the file and spacing it on a line below this will be needed to read the text in my reading settings file for (String setting : settings) { // running though the strings f.write(setting + System.getProperty("line.separator")); } just closing the FileWriter stream of output f.close(); // closing the stream } public void writeConfigSettings(String FileName,String... settings) throws IOException { // thanks to lackofchesee from TS3 for the path name! FileWriter f = new FileWriter(System.getProperty("user.home") + File.separator + "OSBot" + File.separator + "data" + File.separator + FileName+".txt"); // writing to an exact path for (String setting : settings) { // running though the strings f.write(setting + System.getProperty("line.separator")); } f.close(); // closing the stream } in use String selected_herbs[] ={"Ranarr","Guam"}; writeConfigSettings("Settings",selected_herbs); this will save a .txt file in the data folder that will look like this called "Settings" Ranarr Guam Edited August 20, 2013 by TheScrub 1 Link to comment Share on other sites More sharing options...
lolmanden Posted August 22, 2013 Share Posted August 22, 2013 Thank you for the snippet! Link to comment Share on other sites More sharing options...