|
Post by hoanglenin on Sept 9, 2021 12:20:52 GMT
I want get number in region r and paste to Nhap_code, but error
My code:
setImagePath(scriptPath() .. "images") dofile(scriptPath() .. "images.lua") Settings:set("MinSimilarity", 0.8) screen = getRealScreenSize() X = screen:getX() Y = screen:getY() function orc() if exists(A_code) then CodeIP = exists(A_code) r = Region(CodeIP:getX(), CodeIP:getY(), CodeIP:getW(), CodeIP:getW()) local p = numberOCR(r, "power") wait(1) if existsClick(Nhap_Code, 0.3) then type(p) existsClick(Done, 0.3) end end end orc()
error message:
Runtime error: Invalid method call. No such method.
|
|
|
Post by learn777 on Sept 9, 2021 23:16:27 GMT
Try this:
function orc() if exists(A_code) then CodeIP = getLastMatch() r = Region(CodeIP:getX(), CodeIP:getY(), CodeIP:getW(), CodeIP:getW()) local p = numberOCR(r, "power")
I'm curious, why use CodeIP:getW()? Isn't it supposed to be the height?
|
|
|
Post by AnkuLua on Sept 10, 2021 0:30:32 GMT
What's A_code? You should provide the screenshots and images for asking help.
|
|
|
Post by hoanglenin on Sept 11, 2021 0:43:55 GMT
Thanks! I solved it myself as follows:
setImagePath(scriptPath() .. "images") dofile(scriptPath() .. "images.lua") Settings:set("MinSimilarity", 0.8) screen = getRealScreenSize() X = screen:getX() Y = screen:getY()
function orc() if exists(A_code) then CodeIP = exists(A_code) r = Region(CodeIP:getX(), CodeIP:getY(), CodeIP:getW(), CodeIP:getW()) local p = numberOCR(r, "power") N = ""..p.."" wait(1) if existsClick(Nhap_Code, 0.3) then type(N) existsClick(Done, 0.3) end end end
|
|
|
Post by hoanglenin on Sept 11, 2021 0:48:12 GMT
Try this: function orc() if exists(A_code) then CodeIP = getLastMatch() r = Region(CodeIP:getX(), CodeIP:getY(), CodeIP:getW(), CodeIP:getW()) local p = numberOCR(r, "power") I'm curious, why use CodeIP:getW()? Isn't it supposed to be the height? is the width of the image A_code just i want to create an area that starts at the position of A_code and has the size of a square.
|
|