This is the code I have now, it compiles fine but gives me the above error when I try to run it.

```
import java.awt.*;
import java.awt.event.*;
import java.awt.Robot;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Color;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class GunningBot {

    public static void main(String[] args) throws Exception {

        Robot robot = new Robot();
        Color color1 = new Color(195, 174, 196);

        {
            Rectangle rectangle = new Rectangle(0, 0, 1075, 700);

            {
                BufferedImage image = robot.createScreenCapture(rectangle);
                search:
                for (int x = 0; x < rectangle.getWidth(); x++) {
                    for (int y = 0; y < rectangle.getHeight(); y++) {
                        if (image.getRGB(x, y) == color1.getRGB()) {
                            robot.mouseMove(x, y);
                            break search;
                        }
                    }
                }
            }
        }

        robot.delay(0);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.delay(0);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(15);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.delay(0);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(1500);

        robot.mouseMove(510, 440); //DO THIS BOTTOM LEFT

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseMove(500, 140);  //MOVE TO LEFT 5 PXLS
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(250);

        robot.mouseMove(500, 370); //DO THIS TOP RIGHT

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseMove(510, 370);  //MOVE TO RIGHT 5 PXLS
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(250);

        robot.mouseMove(700, 440); //DO THIS RIGHT CORNER MOVE LEFT 5 

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseMove(690, 440);  //MOVE TO LEFT 5 PXLS
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        robot.delay(250);

        robot.mouseMove(315, 370); //DO THIS LEFT CORNER MOVE RIGHT 5 

        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseMove(320, 370);  //MOVE TO RIGHT 5 PXLS
        robot.mouseRelease(InputEvent.BUTTON1_MASK);

    }
}

```

I have found many example fixes that go on about over extending the Array and so on but I don't use an array. So I do not understand how to fix this error for this script. Any help at all would be amazing.

The full error is:

> 
> exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
>  at GunningBot.main(GunningBot.java:39)
> 
> 
> 

bufferimage uses a Raster, could this be the problem?
rectangle is just setting the rectangle of the screen to get a screenshot of.

Also I'm editing the code with Notepad++ and don't know how to set an exception without eclipse.