Last active
April 29, 2019 12:58
-
-
Save Ruttmann/af5dbd9a1a38b84d57c73bf99ec7d8b7 to your computer and use it in GitHub Desktop.
Source-code for Lu Robot.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.AWTException; | |
import java.awt.Robot; | |
import java.awt.event.KeyEvent; | |
import java.io.BufferedReader; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
public class LuRobot { | |
private ArrayList<String> lista = new ArrayList<String>(); | |
public void readFile(String filePath) throws FileNotFoundException, IOException { | |
try(BufferedReader br = new BufferedReader(new FileReader(filePath))) { | |
String line = br.readLine(); | |
while (line != null) { | |
lista.add(line); | |
line = br.readLine(); | |
} | |
} | |
} | |
public void writeValues() throws AWTException { | |
Robot robot = new Robot(); | |
robot.keyPress(KeyEvent.VK_ALT); | |
robot.delay(50); | |
robot.keyPress(KeyEvent.VK_TAB); | |
robot.delay(50); | |
robot.keyRelease(KeyEvent.VK_TAB); | |
robot.delay(50); | |
robot.keyRelease(KeyEvent.VK_ALT); | |
robot.delay(50); | |
for (String text : lista) { | |
for (char c : text.toCharArray()) { | |
int keyCode = KeyEvent.getExtendedKeyCodeForChar(c); | |
robot.keyPress(keyCode); | |
robot.delay(50); | |
robot.keyRelease(keyCode); | |
robot.delay(50); | |
} | |
robot.keyPress(KeyEvent.VK_DOWN); | |
robot.delay(50); | |
robot.keyRelease(KeyEvent.VK_DOWN); | |
robot.delay(50); | |
//For using with Ctrl+C Ctrl+V | |
// StringSelection ss = new StringSelection(text); | |
// Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); | |
// clipboard.setContents(ss, ss); | |
// | |
// robot.keyPress(KeyEvent.VK_CONTROL); | |
// robot.delay(30); | |
// robot.keyPress(KeyEvent.VK_V); | |
// robot.delay(30); | |
// robot.keyRelease(KeyEvent.VK_V); | |
// robot.delay(30); | |
// robot.keyRelease(KeyEvent.VK_CONTROL); | |
// robot.delay(30); | |
// | |
// robot.keyPress(KeyEvent.VK_DOWN); | |
// robot.delay(30); | |
// robot.keyRelease(KeyEvent.VK_DOWN); | |
// robot.delay(30); | |
} | |
} | |
} | |
//============================================================================================================================= | |
import java.awt.AWTException; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
public class Main { | |
public static void main(String[] args) throws FileNotFoundException, IOException, AWTException { | |
LuRobot lu = new LuRobot(); | |
lu.readFile("lu.txt"); | |
lu.writeValues(); | |
} | |
} | |
//============================================================================================================================= | |
//1) Coloque LuRobot.jar na área de trabalho e crie um arquivo chamado lu.txt também na área de trabalho. | |
//2) Cole os valores a serem escritos dentro do arquivo lu.txt. Escreva somente um valor por linha. Verifique se não há linhas em branco no final do arquivo. Caso afirmativo, apague-as. | |
//3) Abra o Bioestat, entre na tela desejada e clique na primeira célula que você deseja preencher. | |
//4) Minimize tudo com Windows+D. | |
//5) Execute o LuRobot.jar. | |
//6) SEJE FELIS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment