RetroBot 35 Share 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? Link to comment Share on other sites More sharing options...
Polymorphism 48 Share 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(); } } Link to comment Share on other sites More sharing options...
RetroBot 35 Author Share 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! Link to comment Share on other sites More sharing options...
Polymorphism 48 Share 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() Link to comment Share on other sites More sharing options...
Scorpius 144 Share Posted March 6, 2018 I had to dive deep to find this, so I'm bumping it. Link to comment Share on other sites More sharing options...
pytho 0 Share Posted April 15, 2020 Is this at all detectable? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.