Article View: borland.public.jbuilder.java.api
Article #1946Re: Gaining access to other programs through java
From: Carlos F Heuberger
Date: Tue, 17 Jul 2001 09:42
Date: Tue, 17 Jul 2001 09:42
41 lines
2139 bytes
2139 bytes
In article <3ac29fb0$1_1@dnews>, peterboivin@yahoo.com says...
> I am interested in simulating human actions on other applications. For
> instance, there is a log file that can only be accessed through the GUI of a
> program written in C++. I do not know C++ so I want to be able to write
> something in Java that will act like it opens the GUI, hit the tab for the
> log, then do an Edit-Select All-Copy (after this paste it to Notepad). Is
> there any way of programming this in Java? Thanks, in advance.
>
>
>
try using the java.awt.Robot Class (jdk1.3) ...
Example: this message was sent by the following code (just the send key
pressed):
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
public class RobT
{
public static void main(String args[])
{
System.out.println("started");
try
{
Robot robot = new Robot();
robot.setAutoDelay(200);
robot.mouseMove(470,60);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
catch (AWTException awx)
{
awx.printStackTrace();
}
System.out.println("ended");
System.exit(0);
}
}
Technical Details
Message-ID:
<MPG.15be26e5a7809be6989683@read.news.de.uu.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.tele.dk!195.238.2.15!skynet.be!bnewspeer01.bru.ops.eu.uu.net!bnewsifeed00.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!emea.uu.net!read.news.de.uu.net!not-for-mailReferences:
<3ac29fb0$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,2fe3c29ec9e1f6f5 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-07-17 02:42:22 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.tele.dk!195.238.2.15!skynet.be!bnewspeer01.bru.ops.eu.uu.net!bnewsifeed00.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!emea.uu.net!read.news.de.uu.net!not-for-mail From: Carlos F Heuberger <cfh@gmx.net.NOSPAM> Newsgroups: borland.public.jbuilder.java.api Subject: Re: Gaining access to other programs through java Date: Tue, 17 Jul 2001 11:42:19 +0200 Message-ID: <MPG.15be26e5a7809be6989683@read.news.de.uu.net> References: <3ac29fb0$1_1@dnews> X-Newsreader: MicroPlanet Gravity v2.20 Lines: 41 NNTP-Posting-Host: 193.102.160.172 X-Trace: 995362940 read.news.de.uu.net 182 193.102.160.172 X-Complaints-To: abuse@de.uu.net