[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.

目录
相关文章
|
Windows
ts-node : 无法加载文件 C:\Users\Dell\AppData\Roaming\npm\ts-node.ps1,因为在此系统上禁止运行脚本。有关详细信息
ts-node : 无法加载文件 C:\Users\Dell\AppData\Roaming\npm\ts-node.ps1,因为在此系统上禁止运行脚本。有关详细信息
261 0
|
网络协议 机器人 Python
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot'
|
安全 Python
python库ffmpeg的错误解决方法:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“
简介:python库ffmpeg的错误解决方法:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“
python库ffmpeg的错误解决方法:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“
|
4月前
|
JavaScript
TS,编写TS文件,编写hello.ts文件,cmd下打开终端,输入tsc hello.ts会生成一个hello.js文件,简化命令,npm i -g ts-node,ts-node hello.ts
TS,编写TS文件,编写hello.ts文件,cmd下打开终端,输入tsc hello.ts会生成一个hello.js文件,简化命令,npm i -g ts-node,ts-node hello.ts
A module cannot have multiple default exports.是、关闭Vetur扩展,或者重启项目,神奇的bug,复制代码造成的
A module cannot have multiple default exports.是、关闭Vetur扩展,或者重启项目,神奇的bug,复制代码造成的
|
JavaScript
UniApp 解决 Error: Cannot find module ‘webpack/lib/RuleSet‘
UniApp 解决 Error: Cannot find module ‘webpack/lib/RuleSet‘
943 0
|
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“. 解决办法
934 0
Python 库配置问题:“Couldn‘t find ffmpeg or avconv - defaulting to ffmpeg, but may not work“. 解决办法
|
Windows
DTMultiWindow UE UMG Multi -window plug -in description
DTMultiWindow UE UMG Multi -window plug -in description
130 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 那么多解决方法和提示)
【Simulink】Three-Phase V-I Measurement 使用方法
【Simulink】Three-Phase V-I Measurement 使用方法