implementing a java robot GUI function in Octave
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear Members,
I am not 100% sure if it is appropriate to ask a question about Octave/MATLAB differences here, but I have seen a few examples so here is my question.
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:5
%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])))
robot.mouseMove(270,125);
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
Erdem
0 Kommentare
Antworten (1)
Walter Roberson
am 13 Mär. 2017
Asking about Octave is not really appropriate here, but...
So I would expect
robot = javaobject("java.awt.Robot");
2 Kommentare
Rik
am 4 Nov. 2017
For future people looking at this: fixing the typo at least lets this line of code run.
robot = javaObject("java.awt.Robot");
Octave sorely lack a forum like this. It is especially annoying in case of issues that can be fixed with the java frame property. The absence of Octave Answers results in my Octave code being much less elegant and fast, even before execution.
Siehe auch
Kategorien
Mehr zu Octave finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!