Re: [Sikuli-driver] [Question #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Eric G confirmed that the question is solved: Thanks RaiMan, 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
Re: [Sikuli-driver] [Question #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Status: Answered => Solved Eric G confirmed that the question is solved: Thank you so much, I get it now. You really helped me out a lot with the findany example! -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 RaiMan proposed the following answer: - how to use findAny() ... based on your first exists example. matches = reg.findAny("pic1", "pic2", "pic3", ... more pictures) if (len(matches) == 0): print "none of them found" # in a loop: use continue to repeat found = matches[0].getIndex() print "found: pic%d" % found +1 -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 RaiMan proposed the following answer: - failsafe feature that terminates the program add this to the top of your script: def terminateHandler(event): exit(1) Env.addHotkey("c", KeyModifier.SHIFT + KeyModifier.ALT, terminateHandler) # example ... use any suitable key combination. Now pressing the key combo during scriptrun will terminate the scriptrun. -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Eric G posted a new comment: in pyautogui there is a failsafe feature that terminates the program if the mouse cursor is detected at (0,0) is there a way I could implement that in Sikuli? I cannot make use of shift alt c during the infinite click loop. I've tried replacing findAll with findAny but I get errors "no viable alternative at input 'match'" -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 RaiMan proposed the following answer: findAny not findAll -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Eric G posted a new comment: Hi again, I've been messing around with findAll and other similar functions from the documentation page... while True: testpics = ("1580408084658.png","1580408094920.png","1580408102639.png") matches = findAll(testpics) if matches: click(Last.Match) else: print "not found" also tried stuff like while True: Match match = reg.findAll("pic1","pic2","pic3") if Match in match: click() I just want the program to continuously look for and click pic1,2,3 but stop when a region is occupied or click only once per match, something along those lines. I'm not sure if I'm even close to being on the right track, I'm still too much of a novice to understand how to do things properly. Can you please recommend some tutorials or video guides that aren't outdated? I really would like to get my stuff to work. -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Eric G posted a new comment: Thanks for such a fast response I'll definitely look into findAny! -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Status: Open => Answered RaiMan proposed the following answer: Hope you using the latest version (2.0.2 sice yesterday) ;-) Depending on the size of the region (BTW: Reg should be reg by convention: names starting with lowercase are variable names, whereas upppercase signals a class name), the avarage 3 searches (max 6) in a row might take too long. Using onAppear or waitVanish would not help either, since the events internally are handled in a row too. Have a look at findAny (https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.findAny), which runs the searches in parallel internally -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Description changed to: Trying to teach myself programming, having a lot of issues with looping...can someone please help me out? I've been stumped for a while. this is the part I'm having trouble with if selected == Comps[0]: while True: if Reg.exists("pic1",0) or Reg.exists("pic2",0) or Reg.exists("pic3",0) or Reg.exists("pic4",0)or Reg.exists("pic 5",0): click(Reg.getLastMatch()) It is for a game, I need to click the units that pop up on my screen, they automatically vanish and appear on my board which has 10 slots. However, every now and then my board becomes full and cannot take another unit until I sell one. But since the units are still "available" my mouse gets stuck in an infinite loop trying to click on them. I don't want to put a wait(2) or something at the end because it would compromise a lot of speed. I also cannot use hotkeys or shift alt c when I constantly click in the game window. I can't really think of a solution to end the infinite mouse clicks other than using waitVanish(Reg.getLastMatch()) to set while loop to false...but that didn't work out please help haha -- 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 #688352]: Mouse stuck in loop
Question #688352 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/688352 Description changed to: Trying to teach myself programming, having a lot of issues with looping...can someone please help me out? I've been stumped for a while. this is the part I'm having trouble with if selected == Comps[0]: while True: if Reg.exists("pic1",0) or Reg.exists("pic2",0) or Reg.exists("pic3",0) or Reg.exists("pic4",0)or Reg.exists("pic 5",0): click(Reg.getLastMatch()) It is for a game, I need to click the pictures that pop up from a pool of randomly generated pictures and they automatically vanish and appear on my board. However, every now and then my board becomes full and my mouse gets stuck in an infinite loop trying to click on the pictures from the pool. I don't want to put a wait(2) or something at the end because it would compromise a lot of speed. I also cannot use hotkeys or shift alt c when I constantly click in the game window. I can't really think of a solution to end the infinite mouse clicks other than using waitVanish(Reg.getLastMatch()) to set while loop to false...but that didn't work out please help haha -- 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
[Sikuli-driver] [Question #688352]: Mouse stuck in loop
New question #688352 on Sikuli: https://answers.launchpad.net/sikuli/+question/688352 Trying to teach myself programming, having a lot of issues with looping...can someone please help me out? I've been stumped for a while. this is the part I'm having trouble with if selected == Comps[0]: while True: if Reg.exists("pic1",0) or Reg.exists("pic2",0) or Reg.exists("pic3",0) or Reg.exists("pic4",0)or Reg.exists("pic 5",0): click(Reg.getLastMatch()) It is for a game, I need to click the pictures that pop up from a pool of randomly generated pictures and they automatically vanish and appear on my board. However, every now and then my board becomes full and my mouse gets stuck in an infinite loop trying to click on the pictures from the pool. I don't want to put a wait(2) or something at the end because it would compromise a lot of speed. I also cannot use hotkeys or shift alt c when I constantly click in the game window. I've tried putting waitVanish(Reg.getLastMatch()) and using onAppear as well...to no success please help haha -- 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