|
Post by chezzy on Apr 4, 2017 7:29:26 GMT
Hello, so Im trying to compare one picture that appears in app with 16 "versions" of similar pics and if there is match it clicks on done button, if it does not match any of these 16 pics, it clicks on "continue" using location. I have this code which works, but its extremely slow. I have found something here on forum, but since my ankulua skills still sucks, I was not able to implement it to make my script faster. Thanks for any help.
Settings:setCompareDimension(true, 720) Settings:setScriptDimension(true, 720) if(exists("ver1.png")) then click("donecap.png") else end if(exists("ver2.png")) then click("donecap.png") else end if(exists("ver3.png")) then click("donecap.png") else end if(exists("ver4.png")) then click("donecap.png") else end if(exists("ver5.png")) then click("donecap.png") else end if(exists("ver6.png")) then click("donecap.png") else end if(exists("ver7.png")) then click("donecap.png") else end if(exists("ver8.png")) then click("donecap.png") else end if(exists("ver9.png")) then click("donecap.png") else end if(exists("ver10.png")) then click("donecap.png") else end if(exists("ver11.png")) then click("donecap.png") else end if(exists("ver12.png")) then click("donecap.png") else end if(exists("ver13.png")) then click("donecap.png") else end if(exists("ver14.png")) then click("donecap.png") else end if(exists("ver15.png")) then click("donecap.png") else end if(exists("ver16.png")) then click("donecap.png") else end click(Location(580, 480))
|
|
|
Post by Mercobots on Apr 4, 2017 8:40:19 GMT
hello download common-library and try regionWaitMulti(),waitMulti(),existsMultiMax()
|
|
|
Post by Sikat on Apr 4, 2017 15:04:56 GMT
Something like this?
Settings:setCompareDimension(true, 720)
Settings:setScriptDimension(true, 720)
if(exists("ver1.png"))
then
click("donecap.png")
else
end
usePreviousSnap(true) if(exists("ver2.png",0))
then
click("donecap.png")
else
end
if(exists("ver3.png",0))
then
click("donecap.png")
else
end
if(exists("ver4.png",0))
then
click("donecap.png")
else
end
if(exists("ver5.png",0))
then
click("donecap.png")
else
end
if(exists("ver6.png",0))
then
click("donecap.png")
else
end
if(exists("ver7.png",0))
then
click("donecap.png")
else
end
--[[etc....]]-- usePreviousSnap(false) click(Location(580, 480))
|
|
|
Post by Mercobots on Apr 4, 2017 16:55:07 GMT
is that you are looking for ?
function waitMulti(target, seconds, skipLocation) local timer = Timer() while (true) do for i, t in ipairs(target) do if (i == 1) then usePreviousSnap(false) else usePreviousSnap(true) end if (exists(t, 0)) then -- check once usePreviousSnap(false) return i, getLastMatch() end end if (skipLocation ~= nil) then click(skipLocation) end if (timer:check() > seconds) then usePreviousSnap(false) return -1 end end end
local images = { "ver1.png", "ver2.png", "ver3.png", "ver4.png", "ver5.png", "ver6.png", }
if waitMulti(images, 0) then click("donecap.png") end
|
|
|
Post by chezzy on Apr 4, 2017 21:33:59 GMT
Hello, thanks I have tried both versions and they are both much faster than it was before.
|
|