python - 我正在尝试实现两个新命令,但它们在我的 Sikuli 脚本中被忽略
问题描述
我正在尝试添加两个新行(最后一个“如果存在”和“doubleClick”),但它们没有被识别。
这是我已经拥有的功能:
def do(a, b, ab, abc, ef, efg):
if not (exists(a, 0) and exists(ab, 0)):
return
doubleClick(abc)
start = time.time()
while exists(ab, 0):
wait(0.1)
while time.time() < (start + 3) and exists(a, 0):
pass
if exists(a, 0):
doubleClick(b)
return
#to be implemented, it has been ignored by the function/script.
#It should be triggered whenever the img5 appears.
#just to be clear, the img5 will only exist if the img1 doesn't exist
if exists(ef, 0):
doubleClick(efg)
while True:
do(a="img1", b="img2", ab="img11", abc="img111", ef="img5", efg="img51")
do(a="img1", b="img2", ab="img12", abc="img121", ef="img5", efg="img51")
我已经尝试删除退货,添加新通行证,放置新退货,但没有任何效果。
除了我要添加的部分之外,一切都运行顺利。
只是发生了任何事情,该功能忽略了那部分。
谢谢你的帮助。
对于给您带来的任何不便,我深表歉意。
我还在学习如何编码,我是个业余爱好者。
解决方案
@RaiMan在 SikuliX Q&A 中帮助了我。
(解决方案)应该如何:
def do(a, b, ab, abc, ef, efg):
if not exists(a, 0):
if exists(ef, 0):
doubleClick(efg)
return
return
if not exists(ab, 0):
return
推荐阅读
- css - 特定选择器的属性
- kendo-ui - 剑道图表:对每个类别的堆积条进行排序
- javascript - 如何处理 setState 中的承诺?
- java - SpringBoot 没有主清单属性(maven)
- sql - 一起至少 X 次 SQL
- java - Android Studio 更新后的 Resources(R) 加载问题
- mysql - 仅根据非唯一参数更新查询中的单行?
- javascript - 下面给出的 javascript 和 jquery 函数在 MAC safari 中不起作用,但在所有其他设备和浏览器中都起作用
- php - 如何将通过ftp传输的文件转换为GIt
- python - 无法在 PyCharm 中安装本地克隆的库