mouseMove works inconsistently

Asked by Daniel Shats

The mouse sometimes moves to its intended location only when run in slow motion, but sometimes not at all. I have tried placing wait() before and after to no avail. This occurs in multiple programs and instances, it is not limited to a particular program. I have written test scripts to verify:

Settings.checkMousePosition = False

pattern = find("pattern.png")
mouseMove(pattern)

The find operation works as evidenced by the target highlighting that occurs in slow mo, but the mouse move doesn't happen.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel Shats
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

System?
Java?
SikuliX version?

Revision history for this message
Daniel Shats (shantzzz) said :
#2

Windows 10
Java 8 (tried installing 9 and 10, Sikuli wouldn't load. Just kept saying "Sikuli IDE loading" but never did)
Sikuli 2.0.1

Revision history for this message
Joshua Noble (shocknoble) said :
#3

If sikuli won't load with newer Java versions, try this:

Launch command prompt as administrator and navigate to your sikulix.jar file.

Type this into your command line:

C:\{PATH TO THE BIN FOLDER OF YOUR NEWEST JAVA VERSION} Java -jar sikulix.jar

As long as you're running as an administrator, you should see the same loading window and then the IDE afterwards

Revision history for this message
Daniel Shats (shantzzz) said :
#4

I followed your instructions and I get the following errors:
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.

Revision history for this message
Daniel Shats (shantzzz) said :
#5

When I type the command line with the path to the bin folder I get:
'C:\"Program Files"\Java\jre-10\bin' is not recognized as an internal or external command,
operable program or batch file.

Revision history for this message
Daniel Shats (shantzzz) said :
#6

After some searching, I typed:
java -jar "{path to sikuli}\sikulix-2.0.1.jar"

and got hung up on the splash screen with this output:

Exception in thread "main" java.lang.IllegalArgumentException: --no-deprecation-warning
        at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options.Options$ParsedArg.<init>(Unknown Source)
        at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options.Options.processArgList(Unknown Source)
        at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.options.Options.process(Unknown Source)
        at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.<init>(Unknown Source)
        at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(Unknown Source)
        at org.sikuli.script.runners.JavaScriptRunner.isSupported(JavaScriptRunner.java:124)
        at org.sikuli.script.support.Runner.initRunners(Runner.java:66)
        at org.sikuli.script.support.Runner.getRunners(Runner.java:100)
        at org.sikuli.idesupport.IDESupport.init(IDESupport.java:83)
        at org.sikuli.ide.SikulixIDE.main(SikulixIDE.java:124)

Revision history for this message
Daniel Shats (shantzzz) said :
#7

Any help on why mouseMove will only work in slow motion?

Revision history for this message
Joshua Noble (shocknoble) said :
#8

Hey Daniel,

To confirm, you are entering into the command line as such? :

C:\Users\%PATH TO SIKULIX JAR%\SikuliX\AppData> "C:\Program Files\Java\jdk-13.0.1\bin\java" -jar sikulix-2.0.1.jar

or at least with your java/bin path?

Revision history for this message
Daniel Shats (shantzzz) said :
#9

Ah, yes that command line worked and mouseMove() now functions as intended.

Thanks for the help and happy new year.

Revision history for this message
Joshua Noble (shocknoble) said :
#10

Awesome, happy to hear it!! RaiMan may be able to provide some insight as to why this is happening, but am thrilled to hear it's working now.

Happy new year!!

Revision history for this message
Daniel Shats (shantzzz) said :
#11

It would indeed be good to know why such a critical Sikuli function requires a workaround. Looking forward to the fix. Thanks again.

Revision history for this message
RaiMan (raimund-hocke) said :
#12

--- It would indeed be good to know why such a critical Sikuli function requires a workaround.

Your problems have nothing to do with anything inside SikuliX.

If you have done the steps, to get SikuliX on your machine according to https://raiman.github.io/SikuliX1/downloads.html

then you have to use the Java that is available on your machine as needed.

Till Java 8 Oracle version, there is a typical Windows installation, that allows to simply use
java ....
on a commandline or double click a .jar file.
This is true for Java 9+ from Oracle.

Due to the changed license scheme of Oracle, the normal private Java user now has to use the OpenJDK versions available for download. These do not have an installer and hence have to be made available in the usual Windows way (System path, System Environment (JAVA_HOME) or use the provided .exe).