[1.1.4 Jython] Region().highlight() doesn't accept values lower than 1.0

Asked by Dirk Schiller on 2019-02-09

import os, sys, time
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + '/sikulixapi.jar')

from org.sikuli.script import App
from org.sikuli.script import Screen
from org.sikuli.basics import Settings
from org.sikuli.script import Mouse
from org.sikuli.script import Location

class Sikuli:

    def __init__(self):
        Mouse.setMouseMovedAction(0) # 0 - Disable User Mouse Interaction
        Settings.MoveMouseDelay = 0.1 # Doesn't work if Settings.setShowActions(False) is executed afterwards
        # Settings.Highlight = False # True - Fires two Times per Action
        # Settings.setShowActions(False) # False - does disable the Settings.MoveMouseDelay Setting
        # Mouse.setMouseMovedHighlight(True) # Doesn't show any Effect
        Settings.MinSimilarity = 0.95
        Settings.DebugLogs = False
        self.screen = Screen()
        self.highlight = True
        self.mouse_move_away_method = 'Offset' # Origin, Offset

    def app(self, app):
            self.app = App(app)
            self.app = App(app)

    def app_open(self):

    def app_close(self):

    def move_offset(self, x, y):
        Mouse.move(x, y)

    def move(self, x, y):
        loc = Location(x, y)

    def click_image(self, image, timeout=5):
        if self.mouse_move_away_method == 'Origin':
            self.move(0, 0)
        if self.mouse_move_away_method == 'Offset':
            self.move_offset(-50, -50)
        reg = self.screen.wait(image, timeout)
        if self.highlight:
            reg.highlight(0.9) # Float Values lower than 1.0 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead

Jython 2.7.0
SikuliXApi.jar Version 1.1.4
Windows 10

The reg.highlight(0.9) throw an Exception:

PS E:\Audio\Audio Installer\Jython\Test> jython .\Script.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState (file:/C:/jython2.7.0/jython.jar) to method java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[log] highlight M[1027,680 74x22]On(0) S 10000 for 0.9 secs
Traceback (most recent call last):
  File ".\Ableton.py", line 11, in <module>
  File "..\sikulix.py", line 52, in click_image
    reg.highlight(0.9) # Float Values like 0.1 not possible; reg.highlight() disable the Click Action; Clicks doesn't come trough; Use reg.highlight(<int>) instead
        at java.base/java.lang.Thread.sleep(Native Method)
        at org.sikuli.util.ScreenHighlighter.closeAfter(ScreenHighlighter.java:144)
        at org.sikuli.util.ScreenHighlighter.highlight(ScreenHighlighter.java:214)
        at org.sikuli.script.Region.highlight(Region.java:2164)
        at org.sikuli.script.Region.highlight(Region.java:2142)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: timeout value is negative

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

see related bug

Can you help with this problem?

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

To post a message you must log in.