Java ROBOT producing error in Excel -


I am looping through a column in Excel and searching for unique values ​​by saving it in an array:

  string [] center = new string [30]; Robot robot = new robot (); Robot.delay (5000); Robot.mouserelease (InputEvent.BUTTON1_MASK); Robot.delay (1000); // For Scroll Down Columns (Int i = 2; I & lt; 5428; i ++) {robot.press (KAVENT.VICE_DOWN); Robot.delay (5); Robot.keyRelease (KeyEvent.VK_DOWN); Robot.delay (5); // copy tile robot KeyPage (KeyEvent.VK_CONTROL); Robot.delay (5); Robot.keyPress (KeyEvent.VK_C); Robot.delay (5); Robot. KeyRelease (Key Event .VK_CONTROL); // Get the contents of the tile string data = (string) Toolkit.getDefaultToolkit () .getSystemClipboard (). GetData (DataFlavor.stringFlavor); Robot.delay (100); // Check that tile is in Array for value (int l = 0; l <30; l ++) {if (center [el]! = (Data)) {centers [l] = data; }} // Columns through scrolling} Any separate tile content variables (intL = 0; l <30; l ++) {if (centers [L] .equals (" "}} {} Second {System.out.println (center [L]}}}}}}   

The problem is that I created a pop-up after copying the first tile Something looks like: Error: Clipboard content can not be emptied, using other program clipboard. What can I do to successfully scan an Excel column?

OK 1

released while copying data C key

  robot.keyRelease (KeyEvent.VK_C);   

Fix 2

After making the content copy a few delays.

Excel can take some time to actually copy the data, it can be negligible to us, but it is not immediate matter to be sufficient to ensure something like 25-50 ms . You should check it to get the right minimum time

Hope this will help.
Best wishes

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -