← Back to team overview

sikuli-driver team mailing list archive

[Question #280168]: Date.time triggering event regardless of time

 

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

Hi,

This is my first time using Sekuli and I have to say I am very impressed. With that in mind I am also a scripting newbie so forgive me if this question is obvious. I have searched the launchpad for answers but the closest I have is this :https://answers.launchpad.net/sikuli/+question/223076

I have replaced my original code with RaiMan's but tweaked it slighlty for my purpose. The issue I am having is that the code runs no matter the time I try. I intend for it to run at a given time and if it runs successfully then not run again until the next day.

Here is my code, thanks for any help and advice. 


Settings.MoveMouseDelay = 0.0
pause = 0.0

import datetime

running = True
Idle = 1
Variablereset = (datetime.datetime.today() + datetime.timedelta(1)).replace(hour=00, minute=1, second=0)
Banquetone = (datetime.datetime.today() + datetime.timedelta(1)).replace(hour=16, minute=35, second=0)
Banquetonecheck = 1


def runHotkey(event):
    global running
    running = False

Env.addHotkey(Key.F1, KeyModifier.CTRL, runHotkey)

SOM = switchApp ("Bluestacks App Player")
while (SOM.hasWindow() and running):
    if datetime.datetime.today() > Banquetone: break
    
    if Banquetonecheck >= 1:
        if exists(Pattern("1451134605300.png").exact()):
            click(Pattern("1451134605300.png").exact())
            if exists(Pattern("1451134711266.png").similar(0.90)):
                click(Pattern("1451134711266.png").similar(0.90))
                if exists("1451134799206.png"):
                    click("1451134799206.png")
                    Banquetonecheck = 0
                    if exists("crossbutton.png"):
                        click("crossbutton.png")
        else: 
            if exists("crossbutton.png"):
                click("crossbutton.png")
    

            
        
        
    
            
        


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