title: Prompt for information multiple times
body: <p>I am new to programming and I'm writing a simple robot in java to split PDF documents and save them to a file.  AS of right now my program asks how many slips (PDF documents) there are and then it asks how many pages there are.  The problem is that it only asks how many pages once.  I need it to ask how many pages are in each individual slip.  First I tried to wrap the JOption statement in an if statement but then the variable was out of scope.  So I made a method for each question, one for number of slips and one for the amount of pages.  I obviously still have the same result.  Can you please help me out?  </p>
  
  <p>Here is my code</p>
  
  <pre><code>//RES. 1366 x 768
  import javax.swing.JOptionPane;
  
  import java.awt.AWTException;
  import java.awt.Robot;
  import java.awt.event.InputEvent;
  import java.awt.event.KeyEvent;
  
  public class automation 
  {
  Robot robot = new Robot();
  public static void main(String [] args) throws AWTException
  {
      new automation();
  }
  public automation() throws AWTException 
  {
      int medDelay = 200;
      int counter2 = 1;
      int slips = slips();
      int pages = pages();
      robot.delay(medDelay);
      while (counter2 &lt;= slips)
      {
  
      counter2 = counter2 + 1;
  
      //move to file in bridge and double click opens file
      robot.delay(3000);
      robot.mouseMove(300, 150);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      //maximize reader window
      robot.keyPress(KeyEvent.VK_WINDOWS);
      robot.keyPress(KeyEvent.VK_UP);
      robot.keyRelease(KeyEvent.VK_UP);
      robot.keyRelease(KeyEvent.VK_WINDOWS);
  
      robot.delay(medDelay);
      //move to tools hit enter
      robot.mouseMove(1190, 100);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      //move to text recognition and click
      robot.mouseMove(1190, 275);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      //scroll down to in this file click and press enter
      robot.mouseMove(1190, 320);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.keyPress(KeyEvent.VK_ENTER);  
      robot.keyRelease(KeyEvent.VK_ENTER);
      //move to book marks and click
      robot.delay(60000);
      robot.mouseMove(10, 170);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      //move to patient name and triple click
      int counter1 = 1;
      while(counter1 &lt;= pages){
      //JOptionPane.showInputDialog("You are on page " + i + "." );
      counter1 = counter1+1;
      robot.delay(medDelay);
      robot.mouseMove(335, 200);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_C);  
      robot.keyRelease(KeyEvent.VK_C);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      //move to create book mark and click
      robot.mouseMove(180, 175);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseMove(50, 100);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      //JOptionPane.showMessageDialog(null, "You are on page " + i + "." );
      }
      robot.delay(medDelay);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_S);  
      robot.keyRelease(KeyEvent.VK_S);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.delay(medDelay);
      robot.mouseMove(10, 170);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseMove(1190, 275);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseMove(1190, 100);
      robot.delay(medDelay);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
      robot.delay(medDelay);
      robot.keyPress(KeyEvent.VK_CONTROL);
      robot.keyPress(KeyEvent.VK_Q);  
      robot.keyRelease(KeyEvent.VK_Q);
      robot.keyRelease(KeyEvent.VK_CONTROL);
      robot.mouseMove(300, 150);
      robot.delay(300);
      robot.mousePress(InputEvent.BUTTON1_MASK);
      robot.delay(300);
      robot.mouseMove(50, 315);
      robot.delay(500);
      robot.mouseRelease(InputEvent.BUTTON1_MASK);
  
      }
  }
  private int slips() {
      String slips = JOptionPane.showInputDialog("How many slips are there?");
      int slip = Integer.parseInt(slips);
      return slip;
  }
  private int pages() {
      String pages = JOptionPane.showInputDialog("How many pages are there?");
      int page = Integer.parseInt(pages);
      return page;
  }
  
  
  }   
  </code></pre>