|
´úÂë½á¹¹·ÖÎö- µã»÷²Ù×÷
hid.click(x, y) : ÔÚÖ¸¶¨µÄ¾ø¶Ô×ø±êµã»÷Ò»´Î¡£hid.clickPercent(arg0, arg1) : ÔÚÖ¸¶¨µÄ°Ù·Ö±È×ø±êµã»÷Ò»´Î¡£hid.clicks(x, y, times, delay) : ÔÚÖ¸¶¨×ø±êÁ¬Ðøµã»÷Ò»¶¨´ÎÊý£¬Ã¿´Îµã»÷Ö®¼äÓÐÖ¸¶¨µÄ¼ä¸ô¡£hid.clicksV2(x, y, press, times, delay) : ÀàËÆÓÚhid.clicks £¬µ«¿ÉÒÔÖ¸¶¨Ã¿´Îµã»÷°´×¡µÄʱ¼ä¡£
- Êó±êµã»÷
hid.mouseClick(arg0, arg1) : ͨ¹ýOTGÉ豸ÔÚÖ¸¶¨×ø±ê½øÐÐÊó±êµã»÷¡£
- ½ÚµãËÑË÷ºÍµã»÷
auto.nodeSearch(timeout) : ËÑË÷½Úµã£¬¿ÉÒÔÖ¸¶¨³¬Ê±Ê±¼ä¡£nodes.clickable(arg0) : ɸѡÊÇ·ñÔÊÐíµã»÷µÄ½Úµã¡£HidNode.prototype.click() : µã»÷½ÚµãµÄÖÐÐĵ㡣HidNode.prototype.clickRandPoint() : ÔÚ½ÚµãµÄ±ß½çÄÚËæ»úµã»÷Ò»´Î¡£HidNode.prototype.isClickable() : ÅжϽڵãÊÇ·ñ¿Éµã»÷¡£
- ´íÎó´¦Àí
- ÔÚ³¢ÊÔ»ñÈ¡½Úµã±ß½çʱʹÓÃÁËtry-catchÓï¾äÀ´²¶»ñ¿ÉÄܵĴíÎ󣬲¢´òÓ¡´íÎóÐÅÏ¢¡£
- Öظ´´úÂë
- ÔÚ³¢ÊÔ»ñÈ¡½Úµã±ß½çʱ£¬
if (this.node) µÄ´úÂë¿é±»Öظ´ÁËÁ½´Î¡£Õâ¿ÉÒÔÓÅ»¯ÎªÖ»¼ì²éÒ»´Î¡£
- Óï·¨´íÎó
- ÔÚ
hid.clicksV2 º¯ÊýµÄprintl Óï¾äÖУ¬ÒýºÅʹÓò»ÕýÈ·£¬Ó¦Îªprintl("Á¬Ðøµã»÷v2: (" + x + ", " + y + ") " + times + "´Î, °´×¡" + press + "ºÁÃë, ÿ´Î¼ä¸ô" + delay + "ºÁÃë"); ¡£
// µã»÷×ø±ê // 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; };
|
|