【图形化编程软件】 sikuli常用函数、简单事件操作 键盘操作 个人总结笔记

sikuli函数、简单事件操作个人总结笔记

 

作者:stormwy

网址:http://blog.csdn.net/stormwy/article/details/7955137


其实sikuli的语法跟python的语法是一样的,大家在学习sikuli时,要看看python的语法,这样就能有更多样的方法来实现丰富的功能。

由于关于sikuli的中文资料实在太少了,我在学习使用sikuli的过程中,记录下下面一些常用操作,以供sikuli学习者参考!

1findAll(图片)

findAll() searches the entire screen for all the matchingvisual patterns and returns a list of locations of those similar patterns. Thiscapability allows us to obtain all the checked items are on the screen. Then,we can simply write a for loop in standard Python syntax and call click() oneach element in the list.

典型例子:Uncheck AllCheckboxes

2、点击操作

click(x)

左键点击元素x

rightClick(x)

右键点击元素x


3below()


4dragDrop()

This function takes two images asarguments. The first image describes the source GUI object to drag and thesecond image describes the appearance of the destination location where the GUIobject should be dragged to and dropped.


典型例子:Working with Sliders


5right()

表示在右边


6popup(string)

弹出一个提示框
例:
popup("Obama has updated his message")
运行:


7、键盘操作:


8Resizinga Window

This tutorial demonstrates how to use Sikuli script to resize a window by dragging its bottom-right corner.
 In order to do so, you have to evaluate the current position of this corner on the screen, 
move the mouse pointer to the applicable click point and then perform one or more drag actions.


9、表示方位的词:

Nearby(number)、above()、below()、left()、right()、getCenter()


10、位置偏移

Location(t.x-30,t.y+30)

其实用图形法会方便和舒服:点击图片,进入设置界面,点击偏移选项卡,然后可以用鼠标设置偏移量,点到哪就偏移到哪,如果想偏移到更远的地方,就滚动鼠标滑轮,可以放大缩小页面,选择偏移点。


11、屏幕翻页


其他键盘操作类型参数见Key (built-in class)


12、读写文件(其实就是python的语法)

#打开 写文件

f=open('c:/wy.txt','a')

t="hello\n"

f . write(t)

f.close()

 

#打开 读文件

f=open('c:/wy.txt','r')

t=f.read()

popup(t)


#open(路径+文件名,读写模式)

#读写模式:r只读,r+读写,w新建(会覆盖原有文件),a追加,b二进制文件.常用模式


13input(“字符串”)

显示一个输入框,以供输入。要输入中文应该在前面加u

input(u“字符串”),不然会乱码


14if语句

If 条件 and 条件:#(注意有冒号,‘#’号表示注释)

       语句


15openApp(应用程序路径名)    

打开应用程序,注意应用程序的路径名里的斜杠“\”要改为双斜杠“\\”。


16、复制、粘贴操作

type("c",KEY_CTRL)  #复制

type("v",KEY_CTRL)  #粘贴


17waitVanish("20120902172907.png",300)

waitVanish()最好带时间,不然还没消失就返回消失的信息了。

我觉得用下面的代替好些

while exists("image.png"):
     wait(1)   
#ifthe image exist i

  • 4
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值