← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #675373]: [HowTo] make a simple loop with "exists image" and "click image"? (Sikuli)

 

Question #675373 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675373

    Status: Open => Answered

RaiMan proposed the following answer:
To better see, what you are doing, you should name your image human
readable:

while exists(“img1", FOREVER):  
     exists(“img11", FOREVER)
     doubleClick(“img111")
     wait (10)
     exists(“img1", FOREVER)
     exists(“img12", FOREVER)
     doubleClick(“img121")
     wait (10)

if I understand right:

step2 = True # step1 should run the first time
while exists("img1", FOREVER):
# wait for img1 and then

  while True: #wait for img11 or img12 FOREVER
    
    # this is step1
    if step2 and exists("img11", 0): # check for img11
      # only do that when starting and then
      # on repeat only if step2 was run before
      doubleClick("img111")
      step2 = False # step2 must be executed
    
    # this is step2
    if exists("img12", 0): # check for img11
      doubleClick("img121")
      step2 = True
         
  wait (10) # wait and then repeat


> On 22. Oct 2018, at 19:12, David Borghi <question675373@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> Question #675373 on Sikuli changed:
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fanswers.launchpad.net%2Fsikuli%2F%2Bquestion%2F675373&amp;data=02%7C01%7C%7C98c309c733e841df121608d6384198f5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636758251717378370&amp;sdata=su%2BIAAZoOF%2BXSqmSABGvLDLTxNoqe7IM8cmnMRsNBd0%3D&amp;reserved=0
> 
>    Status: Answered => Open
> 
> David Borghi is still having a problem:
> Hello, RaiMan.
> 
> Thank you again for your fast response.
> 
> What I was expecting:
> 
> when I see image 1
> then I wait for image 1.1 or 1.2
> If I see image 1.1 click on image 1.1.1
> If I see image 1.2 click on image 1.2.1
> then I wait 10 seconds
> 
> For now, I was able to put both scripts to work in a single script.
> 
> The problem is, one script can be executed only If the other was
> previously executed.
> 
> Translating, If script 1 was executed, It'll be possible to execute it
> again only if script 2 was executed as well.
> 
> So, it's happening in this way:
> 
> script 1
> script 2
> script 1
> script 2
> 
> How the workflow was written:
> 
> while exists("1540053824433-3.png", FOREVER):  
>      exists("1540099469526.png", FOREVER)
>      doubleClick("1540102517023.png")
>      wait (10)
>      exists("1540053824433-3.png", FOREVER)
>      exists("1540069005561.png", FOREVER)
>      doubleClick("1540102829602.png")
>      wait (10)
> 
> Would it be necessary to "separate" both scripts to avoid the "rule" of
> script 1/2/1/2?
> 
> I'm sorry If I was not clear enough, If possible, please, let me know If
> I can describe in a better way.
> 
> Thank you for all your help and your attention.
> I'm sorry for all the inconvenience.
> 
> -- 
> You received this question notification because your team Sikuli Drivers
> is an answer contact for Sikuli.
> 
> _______________________________________________
> Mailing list: https://nam05.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~sikuli-driver&amp;data=02%7C01%7C%7C98c309c733e841df121608d6384198f5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636758251717378370&amp;sdata=UUYuEaI%2BIArxcqzsg6krfYkr2UrMwQyi8H2kp7WCnVo%3D&amp;reserved=0
> Post to     : sikuli-driver@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://nam05.safelinks.protection.outlook.com/?url=https:%2F%2Flaunchpad.net%2F~sikuli-driver&amp;data=02%7C01%7C%7C98c309c733e841df121608d6384198f5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636758251717378370&amp;sdata=UUYuEaI%2BIArxcqzsg6krfYkr2UrMwQyi8H2kp7WCnVo%3D&amp;reserved=0
> More help   : https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhelp.launchpad.net%2FListHelp&amp;data=02%7C01%7C%7C98c309c733e841df121608d6384198f5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636758251717378370&amp;sdata=2vd8NdRCclXoDhsSNoM4E1hj2A021jPBSosDcqbGRyo%3D&amp;reserved=0

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.