← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Description changed to:
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.

I have a feeling that the time might differ from my local time so I am
not inputting the right value. I have tried to print the time to a popup
but for some reason I can't get it to do so.

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


Debug.on(3)
Settings.MoveMouseDelay = 0.0
Settings.UserLogs = True
Settings.ActionLogs = True
Settings.InfoLogs = True
Settings.DebugLogs = True
Settings.LogTime = True
Debug.setLogFile("D:\Sikuli\Bot\shardsbot testing.sikuli\sombot.txt")
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.