Auto.js实现点击屏幕识别颜色 - 附带UI界面代码
var colorUI = dialogs.build({
title: '颜色识别',
customView:
var btn = colorUI.findViewById('btn'); var result = colorUI.findViewById('result');
var x, y;
btn.click(() => { var img = captureScreen(); var c = images.pixel(img, x, y); var r = colors.red(c); var g = colors.green(c); var b = colors.blue(c); result.setText('R:' + r + ', G:' + g + ', B:' + b); });
setInterval(() => { x = getGlobalX(colorUI); y = getGlobalY(colorUI); }, 1000);
colorUI.show();
function getGlobalX(view) { var location = Array.create('int', 2); view.getLocationOnScreen(location); return location[0] + view.getWidth() / 2; }
function getGlobalY(view) { var location = Array.create('int', 2); view.getLocationOnScreen(location); return location[1] + view.getHeight() / 2; }
原文地址: https://www.cveoy.top/t/topic/jvmS 著作权归作者所有。请勿转载和采集!