TRADUZIR CODIGO FONTE
Olá pessoal, blz. Alguém poderia tradizir esse código java para a linguagem VB.
Agradeço
package robot;
import gui.BandejaDigitadorSIC;
import java.awt.Robot;
import java.awt.TrayIcon.MessageType;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Vector;
import util.UtilAreaTranferencia;
import util.UtilProperties;
import util.UtilRobot;
public class RobotAnularNotasCCS extends MouseMotionAdapter
implements IRobot, Runnable
{
private Robot robot = null;
public Thread tarefa;
public BandejaDigitadorSIC trayIcon;
private boolean emPausa;
private boolean loop;
private Vector<Integer> xTela = new Vector();
private Vector<Integer> yTela = new Vector();
private Vector<String> nomeTela = new Vector();
private int nTela;
private int p;
private String contrato;
private SimpleDateFormat formatoDataHora = new SimpleDateFormat([Ô]dd/MM/yyyy HH:mm:ss[Ô]);
public RobotAnularNotasCCS(BandejaDigitadorSIC trayIcon) {
this.trayIcon = trayIcon;
this.tarefa = new Thread(this);
this.emPausa = false;
}
public void mouseMoved(MouseEvent e) {
pausar();
}
public synchronized void continuar() {
this.emPausa = false;
this.trayIcon.setImage(BandejaDigitadorSIC.imgExecutando);
notify();
}
public void iniciar() {
this.trayIcon.setImage(BandejaDigitadorSIC.imgExecutando);
this.tarefa.start();
}
public synchronized void parar() {
continuar();
}
public synchronized void pausar() {
this.emPausa = true;
}
public void run() {
this.loop = true;
try
{
this.robot = new Robot();
this.robot.setAutoDelay(this.trayIcon.getDelayDefault());
UtilRobot.alt(this.robot, 9);
p00_CarregarTelas();
while (this.loop) {
this.p = 1;
this.robot.keyPress(40);
UtilRobot.ctrl(this.robot, 67);
this.contrato = UtilAreaTranferencia.get();
this.contrato = this.contrato.substring(0, this.contrato.length() - 1);
if (this.contrato.equals([Ô][Ô])) {
this.loop = false;
this.robot.keyPress(27);
} else {
UtilRobot.alt(this.robot, 9);
if (this.p == 1) p01_digitarNota();
if (this.p == 2) p02_definir_status();
}
if (this.emPausa) {
this.trayIcon.setImage(BandejaDigitadorSIC.imgPausado);
this.trayIcon.emPausa(Boolean.valueOf(true));
}
synchronized (this) {
try {
while (this.emPausa)
wait();
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
catch (Exception e) {
e.printStackTrace();
this.trayIcon.displayMessage([Ô]ERRO[Ô], e.getMessage(), TrayIcon.MessageType.ERROR);
}
finally {
}
this.trayIcon.setImage(BandejaDigitadorSIC.imgParado);
this.trayIcon.emPausa(Boolean.valueOf(false));
}
private void p00_CarregarTelas() throws IOException {
BufferedReader in = new BufferedReader(new FileReader(UtilProperties.getProperties([Ô]R00_CAMINHO_TELAS[Ô]) + [Ô]Anular Notas\ elas.robot[Ô]));
while (in.ready()) {
String linha = in.readLine();
int x = Integer.parseInt(linha.substring(0, 4));
int y = Integer.parseInt(linha.substring(5, 9));
String tela = linha.substring(10, linha.length());
this.nomeTela.add(UtilProperties.getProperties([Ô]R00_CAMINHO_TELAS[Ô]) + [Ô]Anular Notas\\[Ô] + tela);
this.xTela.add(Integer.valueOf(x));
this.yTela.add(Integer.valueOf(y));
}
in.close();
}
private void p01_digitarNota() throws Exception {
this.p += 1;
int[] num = { 0 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
UtilRobot.apagar(this.robot, 12);
UtilRobot.digitar(this.contrato, this.robot);
this.robot.keyPress(10);
}
private void p02_definir_status()
throws Exception
{
this.p += 1;
int[] num = { 1, 3 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
switch (this.nTela) {
case 1:
this.robot.keyPress(16);
UtilRobot.repetir(this.robot, 9, 4);
this.robot.keyRelease(16);
UtilRobot.repetir(this.robot, 38, 4);
this.robot.keyPress(16);
UtilRobot.repetir(this.robot, 9, 5);
this.robot.keyRelease(16);
this.robot.keyPress(10);
this.robot.delay(200);
this.robot.keyPress(9);
this.robot.keyPress(10);
UtilRobot.clicar(this.robot, 30, 236);
this.robot.keyPress(10);
this.robot.delay(500);
UtilRobot.ctrl(this.robot, 83);
concluir();
break;
case 2:
this.robot.delay(200);
this.p = 99;
this.robot.keyPress(114);
cancelar([Ô]Nota Já Cancelada.[Ô]);
}
}
private void cancelar(String obs)
{
this.robot.keyPress(37);
}
private void concluir()
throws Exception
{
int[] num = { 0 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
UtilRobot.alt(this.robot, 9);
this.robot.keyPress(39);
UtilRobot.digitar([Ô]Cancelada![Ô], this.robot);
UtilRobot.repetir(this.robot, 37, 1);
}
private String horaFinal(String horaInicial)
{
String str = [Ô][Ô];
str = str + horaInicial.substring(0, 3);
int i = Integer.parseInt(horaInicial.substring(3, 5));
i++;
if (i < 10)
str = str + [Ô]0[Ô] + i;
else {
str = str + i;
}
str = str + horaInicial.substring(5, 8);
return str;
}
}
Agradeço
package robot;
import gui.BandejaDigitadorSIC;
import java.awt.Robot;
import java.awt.TrayIcon.MessageType;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Vector;
import util.UtilAreaTranferencia;
import util.UtilProperties;
import util.UtilRobot;
public class RobotAnularNotasCCS extends MouseMotionAdapter
implements IRobot, Runnable
{
private Robot robot = null;
public Thread tarefa;
public BandejaDigitadorSIC trayIcon;
private boolean emPausa;
private boolean loop;
private Vector<Integer> xTela = new Vector();
private Vector<Integer> yTela = new Vector();
private Vector<String> nomeTela = new Vector();
private int nTela;
private int p;
private String contrato;
private SimpleDateFormat formatoDataHora = new SimpleDateFormat([Ô]dd/MM/yyyy HH:mm:ss[Ô]);
public RobotAnularNotasCCS(BandejaDigitadorSIC trayIcon) {
this.trayIcon = trayIcon;
this.tarefa = new Thread(this);
this.emPausa = false;
}
public void mouseMoved(MouseEvent e) {
pausar();
}
public synchronized void continuar() {
this.emPausa = false;
this.trayIcon.setImage(BandejaDigitadorSIC.imgExecutando);
notify();
}
public void iniciar() {
this.trayIcon.setImage(BandejaDigitadorSIC.imgExecutando);
this.tarefa.start();
}
public synchronized void parar() {
continuar();
}
public synchronized void pausar() {
this.emPausa = true;
}
public void run() {
this.loop = true;
try
{
this.robot = new Robot();
this.robot.setAutoDelay(this.trayIcon.getDelayDefault());
UtilRobot.alt(this.robot, 9);
p00_CarregarTelas();
while (this.loop) {
this.p = 1;
this.robot.keyPress(40);
UtilRobot.ctrl(this.robot, 67);
this.contrato = UtilAreaTranferencia.get();
this.contrato = this.contrato.substring(0, this.contrato.length() - 1);
if (this.contrato.equals([Ô][Ô])) {
this.loop = false;
this.robot.keyPress(27);
} else {
UtilRobot.alt(this.robot, 9);
if (this.p == 1) p01_digitarNota();
if (this.p == 2) p02_definir_status();
}
if (this.emPausa) {
this.trayIcon.setImage(BandejaDigitadorSIC.imgPausado);
this.trayIcon.emPausa(Boolean.valueOf(true));
}
synchronized (this) {
try {
while (this.emPausa)
wait();
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
catch (Exception e) {
e.printStackTrace();
this.trayIcon.displayMessage([Ô]ERRO[Ô], e.getMessage(), TrayIcon.MessageType.ERROR);
}
finally {
}
this.trayIcon.setImage(BandejaDigitadorSIC.imgParado);
this.trayIcon.emPausa(Boolean.valueOf(false));
}
private void p00_CarregarTelas() throws IOException {
BufferedReader in = new BufferedReader(new FileReader(UtilProperties.getProperties([Ô]R00_CAMINHO_TELAS[Ô]) + [Ô]Anular Notas\ elas.robot[Ô]));
while (in.ready()) {
String linha = in.readLine();
int x = Integer.parseInt(linha.substring(0, 4));
int y = Integer.parseInt(linha.substring(5, 9));
String tela = linha.substring(10, linha.length());
this.nomeTela.add(UtilProperties.getProperties([Ô]R00_CAMINHO_TELAS[Ô]) + [Ô]Anular Notas\\[Ô] + tela);
this.xTela.add(Integer.valueOf(x));
this.yTela.add(Integer.valueOf(y));
}
in.close();
}
private void p01_digitarNota() throws Exception {
this.p += 1;
int[] num = { 0 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
UtilRobot.apagar(this.robot, 12);
UtilRobot.digitar(this.contrato, this.robot);
this.robot.keyPress(10);
}
private void p02_definir_status()
throws Exception
{
this.p += 1;
int[] num = { 1, 3 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
switch (this.nTela) {
case 1:
this.robot.keyPress(16);
UtilRobot.repetir(this.robot, 9, 4);
this.robot.keyRelease(16);
UtilRobot.repetir(this.robot, 38, 4);
this.robot.keyPress(16);
UtilRobot.repetir(this.robot, 9, 5);
this.robot.keyRelease(16);
this.robot.keyPress(10);
this.robot.delay(200);
this.robot.keyPress(9);
this.robot.keyPress(10);
UtilRobot.clicar(this.robot, 30, 236);
this.robot.keyPress(10);
this.robot.delay(500);
UtilRobot.ctrl(this.robot, 83);
concluir();
break;
case 2:
this.robot.delay(200);
this.p = 99;
this.robot.keyPress(114);
cancelar([Ô]Nota Já Cancelada.[Ô]);
}
}
private void cancelar(String obs)
{
this.robot.keyPress(37);
}
private void concluir()
throws Exception
{
int[] num = { 0 };
this.nTela = UtilRobot.aguardarTelas(num, this.robot, this.nomeTela, this.xTela, this.yTela);
UtilRobot.alt(this.robot, 9);
this.robot.keyPress(39);
UtilRobot.digitar([Ô]Cancelada![Ô], this.robot);
UtilRobot.repetir(this.robot, 37, 1);
}
private String horaFinal(String horaInicial)
{
String str = [Ô][Ô];
str = str + horaInicial.substring(0, 3);
int i = Integer.parseInt(horaInicial.substring(3, 5));
i++;
if (i < 10)
str = str + [Ô]0[Ô] + i;
else {
str = str + i;
}
str = str + horaInicial.substring(5, 8);
return str;
}
}
Você sabe o que o código faz, pois se souber explique, assim fica mais fácil de traduzir o mesmo.
ISSO está para DotNet mais voltado para a Linguagem C# 2.0 e 3.0 vc vai prescisar das classes que compoe estas rotinas que acima vc descreveu
vou comenta uma linha
UtilRobot.repetir(this.robot, 9, 4);
UtilRobot é uma classe e .repetir(this.robot, 9, 4) é um evento dentro dessa classe
portanto esta faltando outras classes que complementam esses códigos acima
Esta faltando o que seria as partes principais desse código.
Boa Sorte
Esse código e de um sisteminha de copiar e colar automatico, onde o programa interage com dois aplicativo ao mesmo tempo.
BOM PESSOAL, REALMENTE O QUE O SISTEMA FAZ E O SEGUINTE, TENHO UM RELAÇÃO DE NOTAS DIGITADOS EM UMA PLANLIHA DO EXCEL, O SISTEMA COPIAR A PRIMEIRA NOTA NA CELULA A1, ABRE O OUTRO SISTEMA COLA NA CAIXA DE TEXTO CLICA NO BOTÃO GRAVAR NOTAS ABRE A PLANILHA NOVAMENTE COPIA CELULA A2 E FAZ O MESMO PROCEDIMENTE ATé A ULTIMA NOTA. E COMO O SISTEMA DESSE O COMANDO ALT+TAB PARA INTERAGIR COM OS DOIS APLICATIVO.
Bom acredito que esta classe UtilRobot deve ser algum tipo de Hook.
Capturar do excel é uma tarefa bem simples independente da linguagem pois ele possui emulação direta através de API agora tudo depende de onde você precisa jogar estes dados se for em um aplicativo windows desktop vai ter que usar as API do windows sendmessage em conjunto com algumas outras para realizar esta operação com algumas limitações agora se for uma aplicação que permita emulação a tarefa ja fica mais simples com as rotinas de Getobject.
Qual é o programa onde você necessita digitar estas notas?
Capturar do excel é uma tarefa bem simples independente da linguagem pois ele possui emulação direta através de API agora tudo depende de onde você precisa jogar estes dados se for em um aplicativo windows desktop vai ter que usar as API do windows sendmessage em conjunto com algumas outras para realizar esta operação com algumas limitações agora se for uma aplicação que permita emulação a tarefa ja fica mais simples com as rotinas de Getobject.
Qual é o programa onde você necessita digitar estas notas?
As notas vão ser digitado no excel, e existem um aplicativo na empresa onde vão receber esses dados para geração destas notas. Esse vai ser um processo repetitivo, poderia criar um exe que quando clicasse nele criasse um icones perto do relogio e quando clicasse com botão do mouse mostrar a opção de Gerar Notas de Serviços, onde os dois aplicativo vão ter que está aberto para interagir juntos.
Segue o código do UtilRopot
package util;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Vector;
import javax.imageio.ImageIO;
import robot.RobotException;
public class UtilRobot
{
public static float TOLERANCIA_PIXELS = 0.0F;
public static int NUM_TENTATIVAS = 50;
public static int DESLOCAMENTO_ACEITAVEL = 0;
public static boolean LOG = false;
public static void alt(Robot r, int tecla)
{
r.keyPress(18);
r.keyPress(tecla);
r.keyRelease(18);
}
public static void ctrl(Robot r, int tecla) {
r.keyPress(17);
r.keyPress(tecla);
r.keyRelease(17);
}
public static void shift(Robot r, int tecla) {
r.keyPress(16);
r.keyPress(tecla);
r.keyRelease(16);
}
public static void tab(Robot r) {
r.keyPress(9);
}
public static void tab(Robot r, int n) {
if (n < 1) n = 1;
for (int i = 0; i < n; i++)
r.keyPress(9);
}
public static void repetir(Robot r, int tecla, int n)
{
if (n < 1) n = 1;
for (int i = 0; i < n; i++)
r.keyPress(tecla);
}
public static void apagar(Robot r, int n)
{
int delayAnterior = r.getAutoDelay();
r.setAutoDelay(25);
repetir(r, 127, n);
r.setAutoDelay(delayAnterior);
}
public static void digitar(String s, Robot r)
{
int delayAnterior = r.getAutoDelay();
r.setAutoDelay(25);
char[] caracteres = s.toCharArray();
for (char c : caracteres) {
switch (c) {
case [ô]0[ô]:
r.keyPress(48);
break;
case [ô]1[ô]:
r.keyPress(49);
break;
case [ô]2[ô]:
r.keyPress(50);
break;
case [ô]3[ô]:
r.keyPress(51);
break;
case [ô]4[ô]:
r.keyPress(52);
break;
case [ô]5[ô]:
r.keyPress(53);
break;
case [ô]6[ô]:
r.keyPress(54);
break;
case [ô]7[ô]:
r.keyPress(55);
break;
case [ô]8[ô]:
r.keyPress(56);
break;
case [ô]9[ô]:
r.keyPress(57);
break;
case [ô]a[ô]:
r.keyPress(65);
break;
case [ô]b[ô]:
r.keyPress(66);
break;
case [ô]c[ô]:
r.keyPress(67);
break;
case [ô]d[ô]:
r.keyPress(68);
break;
case [ô]e[ô]:
r.keyPress(69);
break;
case [ô]f[ô]:
r.keyPress(70);
break;
case [ô]g[ô]:
r.keyPress(71);
break;
case [ô]h[ô]:
r.keyPress(72);
break;
case [ô]i[ô]:
r.keyPress(73);
break;
case [ô]j[ô]:
r.keyPress(74);
break;
case [ô]k[ô]:
r.keyPress(75);
break;
case [ô]l[ô]:
r.keyPress(76);
break;
case [ô]m[ô]:
r.keyPress(77);
break;
case [ô]n[ô]:
r.keyPress(78);
break;
case [ô]o[ô]:
r.keyPress(79);
break;
case [ô]p[ô]:
r.keyPress(80);
break;
case [ô]q[ô]:
r.keyPress(81);
break;
case [ô]r[ô]:
r.keyPress(82);
break;
case [ô]s[ô]:
r.keyPress(83);
break;
case [ô]t[ô]:
r.keyPress(84);
break;
case [ô]u[ô]:
r.keyPress(85);
break;
case [ô]v[ô]:
r.keyPress(86);
break;
case [ô]w[ô]:
r.keyPress(87);
break;
case [ô]x[ô]:
r.keyPress(88);
break;
case [ô]y[ô]:
r.keyPress(89);
break;
case [ô]z[ô]:
r.keyPress(90);
break;
case [ô]A[ô]:
r.keyPress(16);
r.keyPress(65);
r.keyRelease(16);
break;
case [ô]B[ô]:
r.keyPress(16);
r.keyPress(66);
r.keyRelease(16);
break;
case [ô]C[ô]:
r.keyPress(16);
r.keyPress(67);
r.keyRelease(16);
break;
case [ô]D[ô]:
r.keyPress(16);
r.keyPress(68);
r.keyRelease(16);
break;
case [ô]E[ô]:
r.keyPress(16);
r.keyPress(69);
r.keyRelease(16);
break;
case [ô]F[ô]:
r.keyPress(16);
r.keyPress(70);
r.keyRelease(16);
break;
case [ô]G[ô]:
r.keyPress(16);
r.keyPress(71);
r.keyRelease(16);
break;
case [ô]H[ô]:
r.keyPress(16);
r.keyPress(72);
r.keyRelease(16);
break;
case [ô]I[ô]:
r.keyPress(16);
r.keyPress(73);
r.keyRelease(16);
break;
case [ô]J[ô]:
r.keyPress(16);
r.keyPress(74);
r.keyRelease(16);
break;
case [ô]K[ô]:
r.keyPress(16);
r.keyPress(75);
r.keyRelease(16);
break;
case [ô]L[ô]:
r.keyPress(16);
r.keyPress(76);
r.keyRelease(16);
break;
case [ô]M[ô]:
r.keyPress(16);
r.keyPress(77);
r.keyRelease(16);
break;
case [ô]N[ô]:
r.keyPress(16);
r.keyPress(78);
r.keyRelease(16);
break;
case [ô]O[ô]:
r.keyPress(16);
r.keyPress(79);
r.keyRelease(16);
break;
case [ô]P[ô]:
r.keyPress(16);
r.keyPress(80);
r.keyRelease(16);
break;
case [ô]Q[ô]:
r.keyPress(16);
r.keyPress(81);
r.keyRelease(16);
break;
case [ô]R[ô]:
r.keyPress(16);
r.keyPress(82);
r.keyRelease(16);
break;
case [ô]S[ô]:
r.keyPress(16);
r.keyPress(83);
r.keyRelease(16);
break;
case [ô]T[ô]:
r.keyPress(16);
r.keyPress(84);
r.keyRelease(16);
break;
case [ô]U[ô]:
r.keyPress(16);
r.keyPress(85);
r.keyRelease(16);
break;
case [ô]V[ô]:
r.keyPress(16);
r.keyPress(86);
r.keyRelease(16);
break;
case [ô]W[ô]:
r.keyPress(16);
r.keyPress(87);
r.keyRelease(16);
break;
case [ô]X[ô]:
r.keyPress(16);
r.keyPress(88);
r.keyRelease(16);
break;
case [ô]Y[ô]:
r.keyPress(16);
r.keyPress(89);
r.keyRelease(16);
break;
case [ô]Z[ô]:
r.keyPress(16);
r.keyPress(90);
r.keyRelease(16);
break;
case [ô] [ô]:
r.keyPress(32);
break;
case [ô].[ô]:
r.keyPress(46);
break;
case [ô]á[ô]:
r.keyPress(129);
r.keyPress(65);
break;
case [ô]é[ô]:
r.keyPress(129);
r.keyPress(69);
break;
case [ô]Ã[ô]:
r.keyPress(129);
r.keyPress(73);
break;
case [ô]ó[ô]:
r.keyPress(129);
r.keyPress(79);
break;
case [ô]ú[ô]:
r.keyPress(129);
r.keyPress(85);
break;
case [ô]/[ô]:
r.keyPress(111);
break;
case [ô]:[ô]:
r.keyPress(16);
r.keyPress(59);
r.keyRelease(16);
break;
case [ô]+[ô]:
r.keyPress(521);
break;
case [ô]-[ô]:
r.keyPress(45);
break;
case [ô],[ô]:
r.keyPress(44);
break;
case [ô];[ô]:
r.keyPress(59);
break;
case [ô]_[ô]:
r.keyPress(523);
break;
case [ô]![ô]:
r.keyPress(16);
r.keyPress(49);
r.keyRelease(16);
break;
case [ô]@[ô]:
r.keyPress(16);
r.keyPress(50);
r.keyRelease(16);
break;
case [ô]#[ô]:
r.keyPress(16);
r.keyPress(51);
r.keyRelease(16);
break;
case [ô]$[ô]:
r.keyPress(16);
r.keyPress(52);
r.keyRelease(16);
break;
case [ô]%[ô]:
r.keyPress(16);
r.keyPress(53);
r.keyRelease(16);
break;
case [ô]¨[ô]:
r.keyPress(16);
r.keyPress(54);
r.keyRelease(16);
r.keyPress(32);
break;
case [ô]&[ô]:
r.keyPress(16);
r.keyPress(55);
r.keyRelease(16);
break;
case [ô]([ô]:
r.keyPress(16);
r.keyPress(57);
r.keyRelease(16);
break;
case [ô])[ô]:
r.keyPress(16);
r.keyPress(48);
r.keyRelease(16);
break;
case [ô]=[ô]:
r.keyPress(61);
break;
case [ô][Ô][ô]:
case [ô]\[ô][ô]:
case [ô]*[ô]:
case [ô]<[ô]:
case [ô]>[ô]:
case [ô]?[ô]:
case [ô][[ô]:
case [ô]\\[ô]:
case [ô]][ô]:
case [ô]^[ô]:
case [ô]'[ô]:
case [ô]{[ô]:
case [ô]|[ô]:
case [ô]}[ô]:
case [ô]~[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô] [ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô] [ô]:
case [ô]¡[ô]:
case [ô]¢[ô]:
case [ô]£[ô]:
case [ô]¤[ô]:
case [ô]¥[ô]:
case [ô]¦[ô]:
case [ô]§[ô]:
case [ô]©[ô]:
case [ô]ª[ô]:
case [ô]«[ô]:
case [ô]¬[ô]:
case [ô]Â[ô]:
case [ô]®[ô]:
case [ô]¯[ô]:
case [ô]°[ô]:
case [ô]±[ô]:
case [ô]²[ô]:
case [ô]³[ô]:
case [ô]'[ô]:
case [ô]µ[ô]:
case [ô]¶[ô]:
case [ô]·[ô]:
case [ô]¸[ô]:
case [ô]¹[ô]:
case [ô]º[ô]:
case [ô]»[ô]:
case [ô]¼[ô]:
case [ô]½[ô]:
case
package util;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Vector;
import javax.imageio.ImageIO;
import robot.RobotException;
public class UtilRobot
{
public static float TOLERANCIA_PIXELS = 0.0F;
public static int NUM_TENTATIVAS = 50;
public static int DESLOCAMENTO_ACEITAVEL = 0;
public static boolean LOG = false;
public static void alt(Robot r, int tecla)
{
r.keyPress(18);
r.keyPress(tecla);
r.keyRelease(18);
}
public static void ctrl(Robot r, int tecla) {
r.keyPress(17);
r.keyPress(tecla);
r.keyRelease(17);
}
public static void shift(Robot r, int tecla) {
r.keyPress(16);
r.keyPress(tecla);
r.keyRelease(16);
}
public static void tab(Robot r) {
r.keyPress(9);
}
public static void tab(Robot r, int n) {
if (n < 1) n = 1;
for (int i = 0; i < n; i++)
r.keyPress(9);
}
public static void repetir(Robot r, int tecla, int n)
{
if (n < 1) n = 1;
for (int i = 0; i < n; i++)
r.keyPress(tecla);
}
public static void apagar(Robot r, int n)
{
int delayAnterior = r.getAutoDelay();
r.setAutoDelay(25);
repetir(r, 127, n);
r.setAutoDelay(delayAnterior);
}
public static void digitar(String s, Robot r)
{
int delayAnterior = r.getAutoDelay();
r.setAutoDelay(25);
char[] caracteres = s.toCharArray();
for (char c : caracteres) {
switch (c) {
case [ô]0[ô]:
r.keyPress(48);
break;
case [ô]1[ô]:
r.keyPress(49);
break;
case [ô]2[ô]:
r.keyPress(50);
break;
case [ô]3[ô]:
r.keyPress(51);
break;
case [ô]4[ô]:
r.keyPress(52);
break;
case [ô]5[ô]:
r.keyPress(53);
break;
case [ô]6[ô]:
r.keyPress(54);
break;
case [ô]7[ô]:
r.keyPress(55);
break;
case [ô]8[ô]:
r.keyPress(56);
break;
case [ô]9[ô]:
r.keyPress(57);
break;
case [ô]a[ô]:
r.keyPress(65);
break;
case [ô]b[ô]:
r.keyPress(66);
break;
case [ô]c[ô]:
r.keyPress(67);
break;
case [ô]d[ô]:
r.keyPress(68);
break;
case [ô]e[ô]:
r.keyPress(69);
break;
case [ô]f[ô]:
r.keyPress(70);
break;
case [ô]g[ô]:
r.keyPress(71);
break;
case [ô]h[ô]:
r.keyPress(72);
break;
case [ô]i[ô]:
r.keyPress(73);
break;
case [ô]j[ô]:
r.keyPress(74);
break;
case [ô]k[ô]:
r.keyPress(75);
break;
case [ô]l[ô]:
r.keyPress(76);
break;
case [ô]m[ô]:
r.keyPress(77);
break;
case [ô]n[ô]:
r.keyPress(78);
break;
case [ô]o[ô]:
r.keyPress(79);
break;
case [ô]p[ô]:
r.keyPress(80);
break;
case [ô]q[ô]:
r.keyPress(81);
break;
case [ô]r[ô]:
r.keyPress(82);
break;
case [ô]s[ô]:
r.keyPress(83);
break;
case [ô]t[ô]:
r.keyPress(84);
break;
case [ô]u[ô]:
r.keyPress(85);
break;
case [ô]v[ô]:
r.keyPress(86);
break;
case [ô]w[ô]:
r.keyPress(87);
break;
case [ô]x[ô]:
r.keyPress(88);
break;
case [ô]y[ô]:
r.keyPress(89);
break;
case [ô]z[ô]:
r.keyPress(90);
break;
case [ô]A[ô]:
r.keyPress(16);
r.keyPress(65);
r.keyRelease(16);
break;
case [ô]B[ô]:
r.keyPress(16);
r.keyPress(66);
r.keyRelease(16);
break;
case [ô]C[ô]:
r.keyPress(16);
r.keyPress(67);
r.keyRelease(16);
break;
case [ô]D[ô]:
r.keyPress(16);
r.keyPress(68);
r.keyRelease(16);
break;
case [ô]E[ô]:
r.keyPress(16);
r.keyPress(69);
r.keyRelease(16);
break;
case [ô]F[ô]:
r.keyPress(16);
r.keyPress(70);
r.keyRelease(16);
break;
case [ô]G[ô]:
r.keyPress(16);
r.keyPress(71);
r.keyRelease(16);
break;
case [ô]H[ô]:
r.keyPress(16);
r.keyPress(72);
r.keyRelease(16);
break;
case [ô]I[ô]:
r.keyPress(16);
r.keyPress(73);
r.keyRelease(16);
break;
case [ô]J[ô]:
r.keyPress(16);
r.keyPress(74);
r.keyRelease(16);
break;
case [ô]K[ô]:
r.keyPress(16);
r.keyPress(75);
r.keyRelease(16);
break;
case [ô]L[ô]:
r.keyPress(16);
r.keyPress(76);
r.keyRelease(16);
break;
case [ô]M[ô]:
r.keyPress(16);
r.keyPress(77);
r.keyRelease(16);
break;
case [ô]N[ô]:
r.keyPress(16);
r.keyPress(78);
r.keyRelease(16);
break;
case [ô]O[ô]:
r.keyPress(16);
r.keyPress(79);
r.keyRelease(16);
break;
case [ô]P[ô]:
r.keyPress(16);
r.keyPress(80);
r.keyRelease(16);
break;
case [ô]Q[ô]:
r.keyPress(16);
r.keyPress(81);
r.keyRelease(16);
break;
case [ô]R[ô]:
r.keyPress(16);
r.keyPress(82);
r.keyRelease(16);
break;
case [ô]S[ô]:
r.keyPress(16);
r.keyPress(83);
r.keyRelease(16);
break;
case [ô]T[ô]:
r.keyPress(16);
r.keyPress(84);
r.keyRelease(16);
break;
case [ô]U[ô]:
r.keyPress(16);
r.keyPress(85);
r.keyRelease(16);
break;
case [ô]V[ô]:
r.keyPress(16);
r.keyPress(86);
r.keyRelease(16);
break;
case [ô]W[ô]:
r.keyPress(16);
r.keyPress(87);
r.keyRelease(16);
break;
case [ô]X[ô]:
r.keyPress(16);
r.keyPress(88);
r.keyRelease(16);
break;
case [ô]Y[ô]:
r.keyPress(16);
r.keyPress(89);
r.keyRelease(16);
break;
case [ô]Z[ô]:
r.keyPress(16);
r.keyPress(90);
r.keyRelease(16);
break;
case [ô] [ô]:
r.keyPress(32);
break;
case [ô].[ô]:
r.keyPress(46);
break;
case [ô]á[ô]:
r.keyPress(129);
r.keyPress(65);
break;
case [ô]é[ô]:
r.keyPress(129);
r.keyPress(69);
break;
case [ô]Ã[ô]:
r.keyPress(129);
r.keyPress(73);
break;
case [ô]ó[ô]:
r.keyPress(129);
r.keyPress(79);
break;
case [ô]ú[ô]:
r.keyPress(129);
r.keyPress(85);
break;
case [ô]/[ô]:
r.keyPress(111);
break;
case [ô]:[ô]:
r.keyPress(16);
r.keyPress(59);
r.keyRelease(16);
break;
case [ô]+[ô]:
r.keyPress(521);
break;
case [ô]-[ô]:
r.keyPress(45);
break;
case [ô],[ô]:
r.keyPress(44);
break;
case [ô];[ô]:
r.keyPress(59);
break;
case [ô]_[ô]:
r.keyPress(523);
break;
case [ô]![ô]:
r.keyPress(16);
r.keyPress(49);
r.keyRelease(16);
break;
case [ô]@[ô]:
r.keyPress(16);
r.keyPress(50);
r.keyRelease(16);
break;
case [ô]#[ô]:
r.keyPress(16);
r.keyPress(51);
r.keyRelease(16);
break;
case [ô]$[ô]:
r.keyPress(16);
r.keyPress(52);
r.keyRelease(16);
break;
case [ô]%[ô]:
r.keyPress(16);
r.keyPress(53);
r.keyRelease(16);
break;
case [ô]¨[ô]:
r.keyPress(16);
r.keyPress(54);
r.keyRelease(16);
r.keyPress(32);
break;
case [ô]&[ô]:
r.keyPress(16);
r.keyPress(55);
r.keyRelease(16);
break;
case [ô]([ô]:
r.keyPress(16);
r.keyPress(57);
r.keyRelease(16);
break;
case [ô])[ô]:
r.keyPress(16);
r.keyPress(48);
r.keyRelease(16);
break;
case [ô]=[ô]:
r.keyPress(61);
break;
case [ô][Ô][ô]:
case [ô]\[ô][ô]:
case [ô]*[ô]:
case [ô]<[ô]:
case [ô]>[ô]:
case [ô]?[ô]:
case [ô][[ô]:
case [ô]\\[ô]:
case [ô]][ô]:
case [ô]^[ô]:
case [ô]'[ô]:
case [ô]{[ô]:
case [ô]|[ô]:
case [ô]}[ô]:
case [ô]~[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô] [ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô][ô]:
case [ô]Â[ô]:
case [ô][ô]:
case [ô][ô]:
case [ô] [ô]:
case [ô]¡[ô]:
case [ô]¢[ô]:
case [ô]£[ô]:
case [ô]¤[ô]:
case [ô]¥[ô]:
case [ô]¦[ô]:
case [ô]§[ô]:
case [ô]©[ô]:
case [ô]ª[ô]:
case [ô]«[ô]:
case [ô]¬[ô]:
case [ô]Â[ô]:
case [ô]®[ô]:
case [ô]¯[ô]:
case [ô]°[ô]:
case [ô]±[ô]:
case [ô]²[ô]:
case [ô]³[ô]:
case [ô]'[ô]:
case [ô]µ[ô]:
case [ô]¶[ô]:
case [ô]·[ô]:
case [ô]¸[ô]:
case [ô]¹[ô]:
case [ô]º[ô]:
case [ô]»[ô]:
case [ô]¼[ô]:
case [ô]½[ô]:
case
Tópico encerrado , respostas não são mais permitidas