Post by doehead on Oct 11, 2015 2:01:41 GMT
I am searching in specific places on my phone for buttons to click with Ankulua. I am using a phone that has not been rooted. I have Daemon installed and purchased the pro version. At the top of my .lua script I have set my screen width, with the following:
Settings:setCompareDimension(true, 1280)
Settings:setScriptDimension(true, 1280)
I am using a 1st Gen Moto-X with the 720p resolution (1280x720)
The following method is being used to click a button.
function clickButton()
val = false
r = Region(10, 300, 30, 20)
r:highlight(2)
val = r:existsClick(ButtonImage)
if val then
toast("clicked button")
end
return val
end
It is searching in the specified Region for the button image. Just to be clear... Region(10, 300, 30, 20) is broken down as follows. 10 & 300 are the x,y coordinates of my phone screen. 30 & 20 is the area in pixels or the rectangle that it should highlight/search.
When I define: r = Region(10, 300, 30, 20) & highlight it with r:highlight(2), I then grab a screenshot of my phone and pull it into paint to see where it placed the rectangle. The new mapping I find is Region(11, 282, 23, 15).
If I make r = Region(80, 400, 200, 500), I then get back after the screen shot r = Region(76, 376, 183, 343). I seem to be off by a large factor.
The image comparison works great as far as I can tell but I was hoping you could tell me why I am having trouble mapping my coordinates to the correct place on my screen? Let me know if you need more information! Thanks!
Settings:setCompareDimension(true, 1280)
Settings:setScriptDimension(true, 1280)
I am using a 1st Gen Moto-X with the 720p resolution (1280x720)
The following method is being used to click a button.
function clickButton()
val = false
r = Region(10, 300, 30, 20)
r:highlight(2)
val = r:existsClick(ButtonImage)
if val then
toast("clicked button")
end
return val
end
It is searching in the specified Region for the button image. Just to be clear... Region(10, 300, 30, 20) is broken down as follows. 10 & 300 are the x,y coordinates of my phone screen. 30 & 20 is the area in pixels or the rectangle that it should highlight/search.
When I define: r = Region(10, 300, 30, 20) & highlight it with r:highlight(2), I then grab a screenshot of my phone and pull it into paint to see where it placed the rectangle. The new mapping I find is Region(11, 282, 23, 15).
If I make r = Region(80, 400, 200, 500), I then get back after the screen shot r = Region(76, 376, 183, 343). I seem to be off by a large factor.
The image comparison works great as far as I can tell but I was hoping you could tell me why I am having trouble mapping my coordinates to the correct place on my screen? Let me know if you need more information! Thanks!