← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #678376]: [1.1.4] How to set 'similar' from default 0.7 to 1.0 ?

 

Question #678376 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/678376

Description changed to:
My Script:

import os, sys

# https://github.com/blackrosezy/gui-inspect-tool
# https://raiman.github.io/SikuliX1/downloads.html
# http://doc.sikuli.org/javadoc/index.html
# https://sikulix-2014.readthedocs.io/en/latest/genindex.html

# Windows 10 Screen Scale > 100% : [error] RobotDesktop: checkMousePosition: should be L[2880,540]@S(1)...
#   https://github.com/RaiMan/SikuliX-2014/issues/292
# Solution: Scale back to 100% and remake all Screenshots if not done with 100% Scale

jarpath = ';' + os.path.dirname(os.path.realpath(__file__)) + '/sikulixapi-1.1.4.jar' # It's the sikulixapi.jar File; just renamed it to know the Version
if not 'CLASSPATH' in os.environ:
    os.environ['CLASSPATH'] = jarpath
else:
    os.environ['CLASSPATH'] += jarpath

from jnius import autoclass

App = autoclass('org.sikuli.script.App')
Screen = autoclass('org.sikuli.script.Screen')
Pattern = autoclass('org.sikuli.script.Pattern')
Finder = autoclass('org.sikuli.script.Finder')
Settings = autoclass('org.sikuli.basics.Settings') # In Sikuli's JavaDoc this Package is named 'org.sikuli.script.Settings'; very Strange
Debug = autoclass('org.sikuli.basics.Debug')

user = 'DOP'
ext_drive = 'E'

class Sikuli:

    def start_app(self, path, app):
        app = App(os.path.join(path, app))
        app.open()

    def click_image(self, image, timeout=5):
        screen = Screen()
        # Debug.info("Screen: %s", screen)
        # pat = Pattern(image)
        # pat.similar(1.0) # Throw an Error: TypeError: 'float' object is not callable
        # pat.similar = 1.0  # Throw an Error: AttributeError: can't set attribute
        # screen.exists(pat, 0)
        Settings.MinSimilarity = 1.0 # Doesn't work / doesn't show any Effect
        Settings.setShowActions(True) # Doesn't work / doesn't show any Effect
        screen.wait(image, timeout)
        screen.click(image)

    
My Question: How can I set the Similar Sikuli Attribute / Setting from it's default 0.7 Value to 1.0 ?

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.