전역 단축키
Android Macro는 클래스 메서드 외에도 몇 가지 Lua 단축키를 제공합니다. 자주 쓰는 호출을 위한 더 오래되고 짧은 이름이며, 호환성을 위해 유지됩니다.
화면 단축키
| 단축키 | 동등한 호출 |
|---|---|
click(x, y) | Screen:click(x, y) |
click(template) | Screen:click(template) |
find(template) | Screen:find(template) |
exist(template) | Screen:exist(template) |
existClick(template) | Screen:existClick(template) |
swipe(points, params) | Screen:swipe(points, params) |
getScreenSize() | width() 및 height() 함수가 있는 테이블 |
유틸리티 단축키
| 단축키 | 동등한 호출 |
|---|---|
toast(text, ms) | Utils:toast(text, ms) |
alert(text, title) | Utils:alert(text, title) |
sleep(ms) | Utils:sleep(ms) |
wait(ms) | Utils:sleep(ms) |
Point(x, y) | point:newInstance(x, y) |
Color(hex) | color:newInstance(hex) |
예시
local size = getScreenSize()
toast("Screen: " .. size.width() .. " x " .. size.height())
if exist("home.png") then
click("home.png")
end
참고
- 예전 두 인수 점수 형식인
click(template, score),exist(template, score),existClick(template, score)는Screen:setMatchingSimilarity를 호출하며, 이는 현재 SDK에 포함되어 있지 않습니다. 대신FinderParams():setScore(score)를 사용하세요. wait(template, timeout)은Screen:wait()의 단축키가 아닙니다. 이 이름은 sleep 형식에 사용됩니다. 이미지나 텍스트를 기다릴 때는Screen:wait(template, timeout)을 명시적으로 사용하세요.