← Back to team overview

sikuli-driver team mailing list archive

[Question #678616]: onAppear running script when object is not there

 

New question #678616 on Sikuli:
https://answers.launchpad.net/sikuli/+question/678616

This is probably a simple fix but I am very inexperienced with this kind of thing. Just do it in my free time as a hobby when something comes up that I can automate. 

My problem is when I run my script sikuli is finding the object that I specify to carry out an action on appear and telling me that it cannot find the image I am telling it to click on. It shouldnt be trying to click on it though because it does not exist! This is probably a simple problem.

Here is my code.  

Settings.MoveMouseDelay = .1
priceList=Region(373,673,389,39)

purchased=Region(406,714,354,29)
buyr=Region(455,730,314,62)
buyx=Region(724,685,38,53)
torn=Region(132,51,270,142)
nomore=Region(375,280,121,720)
refresh=Region(70,45,34,32)
checkout = Region(683,674,76,35)
bought = Region(502,685,115,57)
bank = Region(262,205,33,29)
manage = Region(376,728,139,39)
income = Region(384,773,132,41)
dropdown = Region(389,814,360,167)
nomoney = Region(416,714,291,33)
withdrawmoney = Region(451,798,56,34)
withdraw = Region(655,795,95,37)
back = Region(8,46,28,30)
windows = Region(0,1038,50,42)

class bankbank:
    def bank2(self):
        wait(1)
        Settings.MoveMouseDelay = .4
        nomoney.onAppear(Pattern("do not have enough money.png").similar(0.39))
        bank.doubleClick("bank icon.png")
        wait(1)
        manage.onAppear("manage companies.png")
        income.click("income chart1.png")
        dropdown.hover("income chart2.png")
        wheel(1 , 8)
        dropdown.click("funds.png")
        wheel(1 , 2)
        withdrawmoney.click("blank area.png")
        type("100k")
        withdraw.click("1550383489075.png")
        back.click()
bankbank
function1=bankbank()

class buybuy:    
    def buy(self): 
         
        while priceList.exists("eyeballa1.png"):
            priceList.click("buybuycart.png")
            
            buyr.onAppear("buybuyyes1.png", buyr.click("buybuyyes2.png"))
           
            popup("begin bank process")
            nomoney.onAppear(Pattern("do not have enough money.png").similar(0.90), function1.bank2())
            wait(.5)
               
                
            buyx.onAppear("white x1.png")
             
            purchased.onAppear("1550352686924-1.png")
            function3.refreshpage()
            wait(1)
buybuy
function2=buybuy()

class refresh2:    
    def refreshpage(self): 
        
        refresh.click("1550423687127.png")
        wait(2)

refresh2
function3=refresh2()


while windows.exists("windows.png"):
    onAppear("cart.png", function2.buy())
    onVanish("cart.png", function3.refreshpage())
        
    popup("start bank process")
    
    nomoney.onAppear(Pattern("do not have enough money.png").similar(0.90), function1.bank2())   
  
    observe(FOREVER) 

Thank you in advance. 

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