help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automating GUI with java robot on Octave


From: PhilipNienhuis
Subject: Re: automating GUI with java robot on Octave
Date: Tue, 14 Mar 2017 13:23:34 -0700 (PDT)

siko1056 wrote
> 
> Erdem Pulcu wrote
>> Dear Members,
>> 
>> I am trying to implement a function which was working perfectly fine in
>> Matlab, and I am trying to implement the same in Octave. I am using a
>> Windows 10 PC with Octave 4.2.1.
>> 
>> Initially when I was installing the Octave for the first time it
>> complained that JRE were not installed, but I fixed this issue by
>> installing and rebooting the program, so it doesn't flag this up anymore.
>> 
>> The Matlab code that I want to run on Octane is below, it should
>> implement some mouse clicks on a GUI in an automated fashion.
>> 
>> robot = java.awt.Robot;
>> screenSizes = get(0, 'MonitorPositions');
>> store(loops,2)=zeros;
>> 
>> for i=1:loops
>> 
>> %Mouse to upper left of primary monitor
>> robot.mouseMove(1, 1)
>> 
>> %Mouse to center of primary monitor
>> robot.mouseMove(mean(screenSizes(1,[1 3])),mean(screenSizes(1,[2 4])))
>> 
>> %Mouse to hardcoded point 200 pixels down and 500 pixels to the right
>> robot.mouseMove(500, 200)
>> 
>> 
>> robot.mouseMove(170,85);
>> pause(1.5)
>> import java.awt.Robot;
>> import java.awt.event.*;
>> mouse = Robot;
>> 
>> %[rest of the code is not relevant so deleted for simplicity]
>> 
>> end
>> 
>> when I run the script Octave says in the command window
>> error: 'java' undefined near line bla bla bla
>> 
>> This GUI automation is very crucial thing for me, so I highly appreciate
>> any recommendations (please give step by step details, as I am not so
>> familiar of using Octave or Java, although fairly ok with Matlab)
>> 
>> Looking forward to hear from you all
>> 
>> Erdem
> Dear Erdem,
> 
> The java support in Octave isn't as "native", as in Matlab. You cannot
> instantiate a Java class using "robot = java.awt.Robot", but "robot =
> javaObject ('java.awt.Robot');" works in both Octave and Matlab.
> 
> See [1] for details.
> 
> HTH,
> Kai
> 
> [1]:
> https://www.gnu.org/software/octave/doc/interpreter/How-to-use-Java-from-within-Octave.html#How-to-use-Java-from-within-Octave

Plus, "import" isn't implemented (yet) in Octave.
For some more Java wishes see here:
https://savannah.gnu.org/task/?12601

Philip



--
View this message in context: 
http://octave.1599824.n4.nabble.com/automating-GUI-with-java-robot-on-Octave-tp4682338p4682357.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]