这几天在按键精灵用到的比较实用的代码

1. 获取网页源码

Function GetTokenForMG
    Dim RequestUrl,Source
    RequestUrl = "http://www.baidu.com/"
    Source = URL.Get(RequestUrl)
End Function

2. 运行APP和杀死APP

RunApp "com.xxx.xxx"
KillApp "com.xxx.xxx"

3. 识别图片位置

Dim intX, intY
FindPic x1, y1, x2, y2, "Attachment:x.png", "000000", 0, 0.6, intX, intY
If intX > 0 and intY > 0 Then 
Else 
End If

4. 读取UI编辑框中的内容

p1 = ReadUIConfig("p1")

5. 随机数生成

Function RndNum(MinNum,MaxNum)
    RndNum=Int((MaxNum-MinNum+1)*Rnd()+MinNum)
End Function

6. 文件保存在设备指定的路径

Import "FileEx.lua"
Call File.Append(GetTempDir() & "filename.txt", "content")

以上就是目前常用到的一些功能,后续用到在补充

猜你喜欢

转载自www.cnblogs.com/xuyi007/p/11128124.html