-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
@kentkrantz first issue report - let me know if it’s matching your expectations
When launching async findColors, the code after the call is executed until any AT function is called -> at this point, AT blocks until async findColors is finished, then it continues execution
Sample’s code output in the logs:
Logs explanation:
Line 1: start of code
Line 2: console.log called right after calling the async findColors
Line 3-14: findColors Finding callback logs, during 5 seconds
Line 15-22 : sample of swiping commands that should have been executed WHILE findColors run
Sample code :
var colors = [{ color: 16417035, x: 0, y: 0 },{ color: 16777215, x: 8, y: 17 }]
var area = {x:89,y:1640,width:425,height:119}
console.log("starting async findColors")
at.findColors({
options : {colors:colors,count:1,region:area,debug:true}, // OPTIONAL, options for finding colors.
duration: '5s', // OPTIONAL, how long time you want it to keep finding? Three formats are supported: 1. `duration: 10` means repeat finding 10 times, the value must be a number, can't be a string; 2. `duration: '60s'` means keep finding for 60 seconds, the value must be seconds + a character 's'; 3. `duration: '2020-05-30 12:00:00'` means keep finding till 2020-05-30 12:00:00. Default is `duration: 10` means repeat 10 times, the value must be a string.
interval: 250, // OPTIONAL, interval between loops in milliseconds, default is 1000 milliseconds.
exitIfFound: false, // OPTIONAL, if exit findColors if got a result successfully, default is true.
eachFindingCallback: () => { // OPTIONAL, will call this function after each finding loop.
console.log("looking..")
},
foundCallback: result => { // OPTIONAL, will call this function while getting matched result, returns the rectangle coordinate matching the action you specified through `matchMethod`.
console.log("result found : " +JSON.stringify(result))
at.tap(result[0].x,result[0].y)
},
errorCallback: error => { // OPTIONAL, handle any error, will exit findColors if got error, if no errorCallback provide, it will alert while getting error.
alert(error)
},
completedCallback: () => { // OPTIONAL, callback when all finding completed
console.log("finished")
},
block: false, // OPTIONAL, you want to run findColors asynchronously or synchronously, block=true means it will run synchronously and block here till completed, default is false, doesn't block here.
})
console.log("let's swipe screen")
at.touchDown(1,500,500)
console.log("touched down!")
at.usleep(100000)
console.log("slept a bit")
for(var i=0;i<= 50;i++){
at.touchMove(1,500+(i*10),500)
at.usleep(50000)
console.log("swiping...")
}
at.usleep(250000)
at.touchUp(1,1000,500)Metadata
Metadata
Assignees
Labels
No labels
