Thread: [MITB Refactored] REAL Screenshot taking in your client

Results 1 to 3 of 3
  1. #1 [MITB Refactored] REAL Screenshot taking in your client 
    Donator


    Join Date
    Sep 2007
    Age
    27
    Posts
    2,426
    Thanks given
    125
    Thanks received
    505
    Rep Power
    386
    I was getting sick of seeing the same old tutorial being reposted over, and over again. Then seeing people repost the reposts, then the original reposters complaining that it was stolen off them.
    Using Robot to take screenshots is reading the output of the screen directly. It can lead to the screenshots being incomplete, and also might cause security issues on certain operating systems in the future (it's the control which is used in java to move the mouse, it's only a matter of time before Mac exclude it. They already change it with their own class)
    So, here's a method of taking screenshots by making the client draw directly to a file, instead of drawing to the screen, reading the screen and then outputting a certain part of it to a file.

    Step 1
    Open client.java
    Add this at the top:
    Code:
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.util.Calendar;
    import javax.imageio.ImageIO;
    Declare the following
    Code:
    public boolean ssQueued = false;
    Then, find
    Code:
    public void processDrawing() {
    Below
    Code:
    anInt1061++;
    Add this
    Code:
            Graphics oG = null;
            BufferedImage ssImage = null;
            if (ssQueued) {
            	oG = super.graphics;
            	ssImage = new BufferedImage(super.getWidth(), super.getHeight(), BufferedImage.TYPE_INT_ARGB);
            	super.graphics = ssImage.getGraphics();
            }
    Then below
    Code:
    if (!loggedIn)
                drawLoginScreen(false);
            else
                drawGameScreen();
    Add
    Code:
    if (ssQueued) {
            	ssQueued = false;
            	super.graphics = oG;
            	try {
            		if (!new File(signlink.findcachedir(), "Screenshots").isDirectory()) new File(signlink.findcachedir(), "Screenshots").mkdirs();
            		Calendar c = Calendar.getInstance();
            		File outFile = new File(signlink.findcachedir(), "Screenshots/"+c.get(Calendar.DAY_OF_MONTH)+"/"+c.get(Calendar.MONTH)+"/"+c.get(Calendar.YEAR)+" "+c.get(Calendar.HOUR_OF_DAY)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND)+"::"+c.get(Calendar.MILLISECOND)+".png");
            		ImageIO.write(ssImage, "png", outFile);
            		pushMessage("Screenshot saved to:", 0, "");
            		pushMessage(outFile.getAbsolutePath(), 0, "");
            	} catch (Exception e) {
            		e.printStackTrace();
            		pushMessage("Error saving screenshot.", 0, "");
            	}
            	super.graphics.drawImage(ssImage, 0, 0, null);
            }
    You may need to edit signlink, and make findcachedir() public.
    Now, people, please stop using Robot to take screenshots.
    To add this to your JFrame, make the button set ssQueued in Client to true. Here's how to do it by :: command.

    Find
    Code:
    if (inputString.equals("::clientdrop"))
    Above
    Code:
    if (myPrivilege == 2) {
    Add
    Code:
    if (inputString.equals("::screenshot")) {
                    		inputTaken = true;
                    		inputString = "";
                    		ssQueued = true;
                    	}
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Donator


    Join Date
    Mar 2011
    Posts
    2,350
    Thanks given
    1,193
    Thanks received
    824
    Rep Power
    856
    gj m8
    Reply With Quote  
     

  4. #3  
    Banned
    Join Date
    May 2013
    Posts
    214
    Thanks given
    9
    Thanks received
    54
    Rep Power
    0
    looks cool, might use
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Playing mp3's in your client
    By Cup-o-cino in forum Tutorials
    Replies: 57
    Last Post: 06-04-2012, 06:24 PM
  2. Playing mp3's in your client
    By Cup-o-cino in forum Tutorials
    Replies: 23
    Last Post: 06-12-2009, 03:48 AM
  3. Replies: 31
    Last Post: 01-01-2009, 04:56 AM
  4. Replies: 44
    Last Post: 04-13-2008, 09:46 PM
  5. Open A Website In Your Client
    By Eleclion in forum Tutorials
    Replies: 4
    Last Post: 02-23-2008, 11:57 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •