How To Change MoveMouseDelay using Java

Asked by Hans

Ho do you change Settings using the Java API?

the public static variable is deprecated.

 I would need to change it to: Settings.MoveMouseDelay = 0.1F

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Lunyov (lunyov-av) said :
#1

What is the version of Sikuli?

May this help you:

import org.sikuli.basics.Settings as Settings
Settings.MoveMouseDelay = 0.1

(Raiman's workaround solution in my case).

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

@Alex
this workaround is only needed in Jython scripting in nightly versions 1.1.1 in May 2016.
It is fixed since beginning of June.

So in Jython scripts this now works again without the import:

Settings.MoveMouseDelay = 0.1

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

For Java usages: ignore the deprecation for now (will be removed in final 1.1.1)

import org.sikuli.basics.Settings;

Settings.MoveMouseDelay = 0.1f;

Revision history for this message
Alex Lunyov (lunyov-av) said :
#5

@RaiMan thanks again, I have successfully installed fixed version as soon as it was released.

Revision history for this message
Hans (happyinkognito) said :
#6

Does not work.

import org.sikuli.basics.Settings;

Settings.MoveMouseDelay = 0.1

as well as

Settings.MoveMouseDelay = 0.1f;

gives me an Unknown Class Compiler Error

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

check your class path setup.

the above packages/classes/names are correct for SikuliX 1.1.0+

Revision history for this message
Hans (happyinkognito) said :
#8

Class setup is correct everything else is also working

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

just tested in a normal Java project having sikulixapi.jar as ext. library (version 1.1.1, IntelliJ IDEA CE, Windows 10-64)

package com.company;
import org.sikuli.basics.Settings;
public class Main {
  public static void main(String[] args) {
    p("Settings.MoveMouseDelay = %.2f", Settings.MoveMouseDelay);
    Settings.MoveMouseDelay = 0.1f;
    p("Settings.MoveMouseDelay = %.2f", Settings.MoveMouseDelay);
  }
  private static void p(String msg, Object... args) {
    System.out.println(String.format(msg, args));
  }
}

prints:
Settings.MoveMouseDelay = 0.50
Settings.MoveMouseDelay = 0.10

Can you help with this problem?

Provide an answer of your own, or ask Hans for more information if necessary.

To post a message you must log in.