RetroBot 35 Posted July 7, 2017 I browsed the api quick and couldn't find if theres a screenshot method in the api. Does anyone know if there's one available or is it not in the current api?
Polymorphism 48 Posted July 7, 2017 I browsed the api quick and couldn't find if theres a screenshot method in the api. Does anyone know if there's one available or is it not in the current api? Not one built into the api, just use native java way of screenshotting. Here's my method -- it will create the folder with script name /** * Takes a screenshot and writes the image as PNG to the dreambot folder * inside of a folder as the name of the script */ public void screenshot() { File file = new File(getManifest().name()); BufferedImage image = getClient().getCanvasImage(); try { if (!file.exists() || !file.isDirectory()) { log("Creating script folder"); file.mkdir(); } log("Saving screenshot..."); ImageIO.write(image, "png", new File(String.format("%s/%s.png", getManifest().name(), System.currentTimeMillis()))); } catch (Exception e) { e.printStackTrace(); } }
RetroBot 35 Author Posted July 7, 2017 Not one built into the api, just use native java way of screenshotting. Here's my method -- it will create the folder with script name /** * Takes a screenshot and writes the image as PNG to the dreambot folder * inside of a folder as the name of the script */ public void screenshot() { File file = new File(getManifest().name()); BufferedImage image = getClient().getCanvasImage(); try { if (!file.exists() || !file.isDirectory()) { log("Creating script folder"); file.mkdir(); } log("Saving screenshot..."); ImageIO.write(image, "png", new File(String.format("%s/%s.png", getManifest().name(), System.currentTimeMillis()))); } catch (Exception e) { e.printStackTrace(); } } Thanks!
Polymorphism 48 Posted July 7, 2017 Thanks! No problem Note: -The folder will be Dreambot/SCRIPT_NAME/ <-- not inside BotData folder -Screenshots are saved with the name of System.currentTimeMillis()
Recommended Posts
Archived
This topic is now archived and is closed to further replies.