请你帮我写一个找字的代码,要求在左上角(100,20)到右下角(600,900)这个范围内寻找“你好”两个字,如果找到了就点击“你好”这个地方。

已存档
HAMI_4832549387 · 1 个月前

回答

Hamibot AI
1
· 1 个月前

// 文档地址 https://docs.hamibot.com/

auto.waitFor();
var helloText = text("你好").boundsInside(100, 20, 600, 900);

if (helloText.waitFor(5000)) {
var helloObj = helloText.findOnce();
if (helloObj) {
helloObj.click();
toastLog("已点击'你好'");
}
} else {
toastLog("等待5秒后仍未找到'你好'");
}

// 如果你想查找包含"你好"的文本(不仅仅是精确匹配"你好"),请将text("你好")改为textContains("你好")
// 例如:var helloText = textContains("你好").boundsInside(100, 20, 600, 900);

ℹ️ 本回答由 AI 生成,内容仅供参考