[sikuli]-控制你的sikuli脚本以及行为

简介:
setShowActions( False | True)

New in version X1.0-rc2.

New in version X1.0-rc2.

If set to True, when a script is run, Sikuli shows a visual effect (a blinking double lined red circle) on the spot where the action will take place before executing actions (e.g.click()dragDrop()type(), etc) for about 2 seconds in the standard (see Settings.SlowMotionDelay ). The default setting is False.

exit( [ value ])

Stops the script gracefully at this point. The value is returned to the calling environment.

class Settings Settings.ActionLogs Settings.InfoLogs Settings.DebugLogs

Either option might be switched on (True) or off (False), to show or hide the respective message type in the IDE console or on command line ([log], [info], [debug]).

Settings.MinSimilarity

The default minimum similiarty of find operations. While using a Region.find() operation, if only an image file is provided, Sikuli searches the region using a default minimum similarity of 0.7.

Settings.MoveMouseDelay

Control the time taken for mouse movement to a target location by setting this value to a decimal value (default 0.5). The unit is seconds. Setting it to 0 will switch off any animation (the mouse will “jump” to the target location).

As a standard behavior the time to move the mouse pointer from the current location to the target location given by mouse actions is 0.5 seconds. During this time, the mouse pointer is moved continuosly with decreasing speed to the target point. An additional benefit of this behavior is, that it gives the active application some time to react on the previous mouse action, since the e.g. click is simulated at the end of the mouse movement:

mmd = Settings.MoveMouseDelay # save default/actual value
click(image1) # implicitly wait 0.5 seconds before click
Settings.MoveMouseDelay = 3
click(image2) # give app 3 seconds time before clicking again
Settings.MoveMouseDelay = mmd # reset to original value
Settings.DelayAfterDrag Settings.DelayBeforeDrop

DelayAfterDrag specifies the waiting time after mouse down at the source location as a decimal value (seconds).

DelayBeforeDrop specifies the waiting time before mouse up at the target location as a decimal value (seconds).

Usage: When using Region.dragDrop() you may have situations, where the operation is not processed as expected. This may be due to the fact, that the Sikuli actions are too fast for the target application to react properly. With these settings the waiting time after the mouse down at the source location and before the mouse up at the target location of a dragDrop operation are controlled. The standard settings are 0.3 seconds for each value. The time that is taken, to move the mouse from source to target is controlled by Settings.MoveMouseDelay:

# you may wish to save the actual settings before
Settings.DelayAfterDrag = 1
Settings.DelayBeforeDrop = 1
Settings.MoveMouseDelay = 3
dragDrop(source_image, target_image)
# time for complete dragDrop: about 5 seconds + search times
Settings.SlowMotionDelay

Control the duration of the visual effect (seconds).

Settings.WaitScanRate Settings.ObserveScanRate

Specify the number of times actual search operations are performed per second while waiting for a pattern to appear or vanish.

As a standard behavior Sikuli internally processes about 3 search operations per second, when processing a Region.wait()Region.exists()Region.waitVanish(),Region.observe()). In cases where this leads to an excessive usage of system ressources or if you intentionally want to look for the visual object not so often, you may set the respective values to what you need. Since the value is used as a rate per second, specifying values between 1 and near zero, leads to scans every x seconds (e.g. specifying 0.5 will lead to scans every 2 seconds):

def myHandler(e):
        print "it happened"

# you may wish to save the actual settings before
Settings.ObserveScanRate = 0.2
onAppear(some_image, myHandler)
observe(FOREVER, background = True)
# the observer will look every 5 seconds
# since your script does not wait here, you
# might want to stop the observing later on ;-)
Settings.ObserveMinChangedPixels

The minimum size in pixels of a change to trigger a change event when using Region.onChange() without specifying this value. The default value is 50.

目录
相关文章
|
7月前
|
JavaScript Python 内存技术
error C:\Users\Acer\Downloads\Desktop\hrsaas-84\node_modules\deasync: 莫名其妙报错一堆python问题
error C:\Users\Acer\Downloads\Desktop\hrsaas-84\node_modules\deasync: 莫名其妙报错一堆python问题
126 0
|
11月前
|
前端开发
VScode执行tsc xx.ts出现以下错误
VScode执行tsc xx.ts出现以下错误
|
网络协议 机器人 Python
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
|
7月前
|
资源调度 JavaScript 前端开发
如何解决 Angular custom library module 在 ng build 时无法被识别的错误
如何解决 Angular custom library module 在 ng build 时无法被识别的错误
44 0
【Simulink】Three-Phase V-I Measurement 使用方法
【Simulink】Three-Phase V-I Measurement 使用方法
【Simulink】查找模块的四种方法
【Simulink】查找模块的四种方法
1207 0
编译错误:vulkan/vulkan.h:没有那个文件或目录
编译错误:vulkan/vulkan.h:没有那个文件或目录
108 0
|
JavaScript IDE 开发工具
vs code + ts + volar == webstorm More actions + 部分重构?白嫖党的胜利?
打算用 ts + vue 写一个新项目,突然发现 vs code 竟然还有 Quick Fix... 这个功能,这个功能需要搭配 volar,因为用 vetur 的时候我没看到有出现,在配合 ts 适用是能让人有种使用 IDEA 的错觉,就是 More actions...,你甚至可以将热键改成 alt + enter(回车),那就和 IDEA 一模一样了(当然比不上 IDEA 那么多解决方法和提示)
|
Python
Python 库配置问题:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“. 解决办法
Python 库配置问题:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“. 解决办法
749 0
Python 库配置问题:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“. 解决办法
HDLBits(1)——Modules:Hierarchy(中)
目录 HDLBits——Modules:Hierarchy 问题19 Module 将信息连接到端口 By position By name 问题20 Connecting ports by position(Module pos) 问题21 Connecting ports by name(Module name) 问题22 Three modules(Module shift) 问题23 Modules and vectors(Module shift8) 问题24 Adder 1(Module add) 问题25 Adder 2(Module fadd) 问题26 Carry-selec
79 0
HDLBits(1)——Modules:Hierarchy(中)