forked from chudongjingling/open_code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path通用无限点击脚本.lua
274 lines (253 loc) · 5.53 KB
/
通用无限点击脚本.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
w,h = getScreenSize();
--初始化的默认值
ClickX,ClickY = 300,150
function Main()
os_type = getOSType()
if os_type=="android" then
--安卓设备
init(0)
elseif os_type=="ios" then
--ios设备
init("",0)
end
My主函数()
end
function My主函数()
-- ret=是否点击,
-- ClickInterval=按下间隔,
-- Interval=两次按下间隔,
-- setClick=循环次数,
-- Cycle=设置坐标方式
ret,ClickInterval,Interval,setClick,Cycle = My设置()
if ret==1 then
-- 按下抬起间隔 默认30
ClickInterval = tonumber(ClickInterval)
Interval = tonumber(Interval)
setClick = tonumber(setClick)
Cycle = tonumber(Cycle)
if ClickInterval == "number" and ClickInterval > 0 then
else
ClickInterval = 30
end
-- 两次按下间隔 默认0
if Interval == "number" and Interval > 0then
else
Interval = 0
end
-- 设置坐标方式 默认手动设置
if Cycle == 0 then
ret,ClickX,ClickY = My手动设置点击位置()
ClickX = tonumber(ClickX)
ClickY = tonumber(ClickY)
if ret == 1 then
if ClickX ~= nil and ClickX > 0 and ClickX < w and ClickY ~= nil and ClickY > 0 and ClickY < h then
else
ClickX,ClickY = 300,150
end
else
ClickX,ClickY = 300,150
end
else
My自动获取点击位置()
end
-- 循环次数 默认无限循环
if setClick == nil then
My无限循环(ClickX,ClickY,ClickInterval,Interval)
elseif setClick > 0 then
My计次循环(setClick,ClickX,ClickY,ClickInterval,Interval)
end
else
toast("退出脚本")
mSleep(500)
lua_exit()
end
end
function My自动获取点击位置()
dialog("点击确定后,自动捕捉下次点击位置.", 0)
x,y = catchTouchPoint();
choice = dialogRet("确定使用这个坐标值么?\rx:"..x.." y:"..y, "是", "从新获取", "", 0);
if choice == 0 then --男
ClickX = x
ClickY = y
elseif choice == 1 then --女
My自动获取点击位置()
end
mSleep(500)
end
function My计次循环(setClick,ClickX,ClickY,ClickInterval,Interval)
for x=1,setClick do
MyClick(ClickX,ClickY,ClickInterval,Interval);
end
end
function My无限循环(ClickX,ClickY,ClickInterval,Interval)
while (true) do
MyClick(ClickX,ClickY,ClickInterval,Interval);
end
end
function My设置()
MyJsonString = [[
{
"style" : "default",
"config" : "shaoye_wuxiandianji",
"width" : ]]..w..[[,
"height" : ]]..h..[[,
"bg" : "#00000000",
"timer" : 0,
"cancelname" : "取消",
"okname" : "开始",
"views": [
{
"type": "Label",
"text": "请完成设置",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "按下抬起间隔(单位:毫秒)",
"size": 22,
"color": "109,109,109"
},{
"type": "Edit",
"prompt": "默认30毫秒",
"size": 20,
"text": "30",
"align": "left",
"color": "109,109,109"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "两次按下间隔(单位:毫秒)",
"size": 22,
"color": "109,109,109"
},{
"type": "Edit",
"prompt": "默认0",
"size": 20,
"text": "0",
"align": "left",
"color": "109,109,109"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "循环次数(无限循环什么都不填)",
"size": 22,
"color": "109,109,109"
},{
"type": "Edit",
"prompt": "默认无限循环",
"size": 20,
"align": "left",
"color": "109,109,109"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "坐标设置方式",
"size": 22,
"color": "109,109,109"
},{
"type": "RadioGroup",
"list": "手动输入点击坐标,自动输入电极坐标",
"select": "0"
}
]
}
]]
return showUI(MyJsonString);
end
function My手动设置点击位置()
MyJsonString = [[
{
"style" : "default",
"config" : "shaoye_wuxiandianji2",
"width" : ]]..w..[[,
"height" : ]]..h..[[,
"bg" : "#00000000",
"timer" : 0,
"cancelname" : "取消",
"okname" : "开始",
"views": [
{
"type": "Label",
"text": "请完成设置",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "X轴坐标,取值范围0~]]..w..[[",
"size": 22,
"color": "109,109,109"
},{
"type": "Edit",
"prompt": "300",
"size": 20,
"align": "left",
"color": "109,109,109"
},{
"type": "Label",
"text": " ",
"size": 25,
"align": "center",
"color": "95,169,0"
},{
"type": "Label",
"text": "Y轴坐标,取值范围0~]]..h..[[",
"size": 22,
"color": "109,109,109"
},{
"type": "Edit",
"prompt": "150",
"size": 20,
"align": "left",
"color": "109,109,109"
}
]
}
]]
ret, ClickX,ClickY = showUI(MyJsonString);
return ret,ClickX,ClickY;
end
--[[
单击方法
参数说明:
ClickX = 点击X坐标
ClickY = 点击Y坐标
ClickInterval = 按下抬起间隔
Interval = 事件结束间隔
]]--
function MyClick(ClickX,ClickY,ClickInterval,Interval)
--dialog(ClickX..":"..ClickY, 0)
touchDown(ClickX,ClickY)
mSleep(ClickInterval)
touchUp(ClickX,ClickY)
mSleep(Interval)
end
Main()