信息发布软件,b2b软件,广告发布软件

标题: AIWROK软件HID点击方法的方法集合小结 [打印本页]

作者: 群发软件    时间: 3 天前
标题: AIWROK软件HID点击方法的方法集合小结
// 点击坐标
// boolean click(int x, int y) 返回值: boolean
// 参数: int x: 横坐标 int y: 纵坐标
// 案例: hid.click(0, 0)
hid.click(0, 0)

// 点击百分比坐标
// void clickPercent(double arg0, double arg1) 返回值: void
// 参数: double arg0: 横坐标 double arg1: 纵坐标
// 案例: hid.clickPercent(0, 0)
hid.clickPercent(0, 0)

// 连续点击
// boolean clicks(int x, int y, int times, int delay) 返回值: boolean
// 参数: int x: 横坐标 int y: 纵坐标 int times: 点击次数 int delay: 每次间隔毫秒
// 案例: hid.clicks(0, 0, 10, 500)
hid.clicks(0, 0, 10, 500)

// 连续点击v2可设置按下时长
// boolean clicksV2(int x, int y, int press, int times, int delay) 返回值: boolean
// 参数: int x: 横坐标 int y: 纵坐标 int press: 按住时间 int times: 点击次数 int delay: 每次间隔毫秒
// 案例: hid.clicksV2(0, 0, 100, 10, 500)
hid.clicksV2(0, 0, 100, 10, 500)

// 鼠标点击
// 暂时只支持新版otg设备
// void mouseClick(int arg0, int arg1) 返回值: void
// 参数: int arg0: 横坐标 int arg1: 纵坐标
// 案例: hid.mouseClick(0, 0)
hid.mouseClick(0, 0)

// 节点允许点击
// 筛选是否允许点击的节点, true允许, false不允许
// nodes clickable(boolean arg0) 返回值: nodes
// 参数: boolean arg0: true
// 案例: auto.nodeSearch(100).clickable(true)
auto.nodeSearch(100).clickable(true)

// hid点击元素随机坐标
// boolean clickRandPoint() 返回值: boolean
// 参数: 无
// 案例: new HidNode().clickRandPoint()
new HidNode().clickRandPoint()

// hid点击
// boolean hidClick() 返回值: boolean
// 参数: 无
// 案例: new HidNode().hidClick()
new HidNode().hidClick()

// 是否允许点击
// boolean isClickable() 返回值: boolean
// 参数: 无
// 案例: new HidNode().isClickable()
new HidNode().isClickable()

// hid点击
// boolean hidClick() 返回值: boolean
// 参数: 无
// 案例: new detect().hidClick()
new detect().hidClick()

// hid点击
// boolean hidClick() 返回值: boolean
// 参数: 无
// 案例: new node().hidClick()
new node().hidClick()

if (this.node) {
// 获取节点边界
this.bounds = {
left: parseInt(this.node.boundsPercent[0] * this.node.bounds[2]),
top: parseInt(this.node.boundsPercent[1] * this.node.bounds[3]),
right: parseInt(this.node.boundsPercent[2] * this.node.bounds[2]),
bottom: parseInt(this.node.boundsPercent[3] * this.node.bounds[3])
};
} else {
printl("节点未找到");
}

try {
// 获取节点边界
if (this.node) {
// 获取节点边界
this.bounds = {
left: parseInt(this.node.boundsPercent[0] * this.node.bounds[2]),
top: parseInt(this.node.boundsPercent[1] * this.node.bounds[3]),
right: parseInt(this.node.boundsPercent[2] * this.node.bounds[2]),
bottom: parseInt(this.node.boundsPercent[3] * this.node.bounds[3])
};
}
} catch (e) {
printl("节点搜索失败: " + e);
}

return this;

/**
* 点击节点中心点
* @return {boolean} 点击是否成功
*/
HidNode.prototype.click = function() {
if (!this.isClickable()) {
printl("节点不允许点击");
return false;
}
var centerX = (this.bounds.left + this.bounds.right) / 2;
var centerY = (this.bounds.top + this.bounds.bottom) / 2;
try {
this.clicks(centerX, centerY, 1, 0);
} catch (e) {
printl("点击失败: " + e);
return false;
}
return true;
};

/**
* 点击元素随机坐标
* @return {boolean} 点击是否成功
*/
HidNode.prototype.clickRandPoint = function() {
if (!this.isClickable()) {
printl("节点不允许点击");
return false;
}
var randX = this.bounds.left + Math.random() * (this.bounds.right - this.bounds.left);
var randY = this.bounds.top + Math.random() * (this.bounds.bottom - this.bounds.top);
try {
this.click(randX, randY);
} catch (e) {
printl("点击失败: " + e);
return false;
}
return true;
};

/**
* 是否允许点击
* @return {boolean} 允许点击返回true, 否则返回false
*/
HidNode.prototype.isClickable = function() {
return this.node.clickable;
};

/**
* 鼠标点击
* @param {int} arg0: 横坐标
* @param {int} arg1: 纵坐标
*/
hid.mouseClick = function(arg0, arg1) {
// 实现鼠标点击逻辑
printl("鼠标点击: (" + arg0 + ", " + arg1 + ")");
};

/**
* 连续点击
* @param {int} x: 横坐标
* @param {int} y: 纵坐标
* @param {int} times: 点击次数
* @param {int} delay: 每次间隔毫秒
* @return {boolean} 点击是否成功
*/
hid.clicks = function(x, y, times, delay) {
for (var i = 0; i < times; i++) {
this.click(x, y);
java.lang.Thread.sleep(delay);
}
printl("连续点击: (" + x + ", " + y + ") " + times + "次, 每次间隔" + delay + "毫秒");
return true;
};

/**
* 连续点击v2可设置按下时长
* @param {int} x: 横坐标
* @param {int} y: 纵坐标
* @param {int} press: 按住时间
* @param {int} times: 点击次数
* @param {int} delay: 每次间隔毫秒
* @return {boolean} 点击是否成功
*/
hid.clicksV2 = function(x, y, press, times, delay) {
for (var i = 0; i < times; i++) {
this.click(x, y);
java.lang.Thread.sleep(press);
java.lang.Thread.sleep(delay - press);
}
printl("连续点击v2: (" + x + ", " + y + ") " + times + "次, 按住" + press + "毫秒, 每次间隔" + delay + "毫秒");
return true;
};

// 节点允许点击
// 筛选是否允许点击的节点, true允许, false不允许
// nodes clickable(boolean arg0) 返回值: nodes
// 参数: boolean arg0: true
// 案例: auto.nodeSearch(100).clickable(true)
auto.nodeSearch = function(timeout) {
// 实现节点搜索逻辑
return {
clickable: function(arg0) {
if (arg0) {
// 筛选允许点击的节点
printl("筛选允许点击的节点");
}
return this;
}
};
};

// hid点击
// boolean hidClick() 返回值: boolean
// 参数: 无
// 案例: new detect().hidClick()
detect.prototype.hidClick = function() {
// 实现hid点击逻辑
printl("detect点击");
return true;
};

// hid点击
// boolean hidClick() 返回值: boolean
// 参数: 无
// 案例: new node().hidClick()
node.prototype.hidClick = function() {
// 实现hid点击逻辑
printl("node点击");
return true;
};
AIWROK软件HID点击方法的方法集合小结 b2b软件 AIWROK软件HID点击方法的方法集合小结 b2b软件 AIWROK软件HID点击方法的方法集合小结 b2b软件

代码结构分析

  1. 点击操作
  1. 鼠标点击
  1. 节点搜索和点击
  1. 错误处理
  1. 重复代码
  1. 语法错误





欢迎光临 信息发布软件,b2b软件,广告发布软件 (http://www.postbbs.com/) Powered by Discuz! X3.2