[Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
New question #658596 on Sikuli: https://answers.launchpad.net/sikuli/+question/658596 So I have a loop that's looking for an image that slowly changes over time, slowly changes back, so need it to look for them in sequence. Here's an example of what I have with just two images, there's actually way more images in the real loop. "print('1st loop') while True: if exists(Pattern("1505851538186.png").targetOffset(-12,-37)): print('found 1st image at 1st loop') break elif exists(Pattern("1521782392359.png").targetOffset(-8,-33)): print('found 2nd image at 1st loop') break else: print('none of the images found at the 1st loop') #something that will lower the match by 1% continue hover(getLastMatch())" Exactly what the match percentage should be is getting hard to pin down, so would like it to start at 99% and after it hits tge bottom of the loop the percentage for all patterns gets lowered to 98% and so on. I know how to program it to stop when the match gets to low, at that point I'll add another pattern. I found this "https://answers.launchpad.net/sikuli/+question/256236"; So I assume the solution is to do with .similar, I've already been able to turn one images 99% into 98% right there on the same line, but that means it never looked for it at 99% So not sure yet how to just lower the match at the bottom of the loop. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 Description changed to: So I have a loop that's looking for an image that slowly changes over time, slowly changes back, so need it to look for them in sequence. Here's an example of what I have with just two images, there's actually way more images in the real loop. "print('1st loop') while True: if exists(Pattern("1505851538186.png").targetOffset(-12,-37)): print('found 1st image at 1st loop') break elif exists(Pattern("1521782392359.png").targetOffset(-8,-33)): print('found 2nd image at 1st loop') break else: print('none of the images found at the 1st loop') #something that will lower the match by 1% continue hover(getLastMatch())" Exactly what the match percentage should be is getting hard to pin down, so would like it to start at 99% and after it hits tge bottom of the loop the percentage for all patterns gets lowered to 98% and so on. I know how to program it to stop when the match gets to low, at that point I'll add another pattern. I found this "https://answers.launchpad.net/sikuli/+question/256236"; So I assume the solution is to do with .similar, I've already been able to turn one images 99% into 98% right there on the same line, but that means it never looked for it at 99% So not sure yet how to just lower the match at the bottom of the loop. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 Description changed to: So I have a loop that's looking for an image that slowly changes over time, slowly changes back, so need it to look for them in sequence. Here's an example of what I have with just two images, there's actually way more images in the real loop. "print('1st loop') while True: if exists(Pattern("1505851538186.png").targetOffset(-12,-37)): print('found 1st image at 1st loop') break elif exists(Pattern("1521782392359.png").targetOffset(-8,-33)): print('found 2nd image at 1st loop') break else: print('none of the images found at the 1st loop') #something that will lower the match by 1% continue hover(getLastMatch())" Exactly what the match percentage should be is getting hard to pin down, so would like it to start at 99% and after it hits tge bottom of the loop the percentage for all patterns gets lowered to 98% and so on. I know how to program it to stop when the match gets to low, at that point I'll add another pattern. I found this "https://answers.launchpad.net/sikuli/+question/256236"; So I assume the solution is to do with .similar, I've already been able to turn one images 99% into 98% right there on the same line, but that means it never looked for it at 99% So not sure yet how to just lower the match at the bottom of the loop. Sikuli version is 1.1.1 Windows 7 -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 Status: Open => Answered TestMechanic proposed the following answer: I am not sure what is the question here. I guess you are looking for 'similar' command: Pattern("some- element.png").similar(0.85) Have in mind 2 more things: -- There is a scan rate for images in Sikuli. It is 3 times/second by default -- The exists command without parameter will look for image for relative short time - 3 seconds by default If you can give more information what is the end goal we may be able to help you better. You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 Manfred Hampl proposed the following answer: If I interpret your question correctly, then you are looking for something like print('1st loop') mySimilarity = 1.0 while True: if exists(Pattern("1505851538186.png").similar(mySimilarity)): print('found 1st image at 1st loop with similarity %f') % mySimilarity break elif exists(Pattern("1521782392359.png").similar(mySimilarity)): print('found 2nd image at 1st loop with similarity %f') % mySimilarity break else: print('none of the images found at the 1st loop') mySimilarity = mySimilarity - 0.05 # reduce by 5% continue hover(getLastMatch()) -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 Status: Answered => Solved arminius confirmed that the question is solved: so sorry, I forgot to thank you for this, that's perfect, you even anticipated the need for the print part. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #658596]: Lower pattern match within a loop on repeat
Question #658596 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/658596 arminius confirmed that the question is solved: Thanks Manfred Hampl, that solved my question. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp