← Back to team overview

sikuli-driver team mailing list archive

[Question #257717]: Variable versus time

 

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

Hello.

I need to display a variable depending on the current time of day and then that it is used throughout the code.

Example:

import datetime
import time

nighttime = (datetime.datetime.today() + datetime.timedelta()).replace(hour=0, minute=0, second=0)
morntime = (datetime.datetime.today() + datetime.timedelta()).replace(hour=6, minute=0, second=0)
daytime = (datetime.datetime.today() + datetime.timedelta()).replace(hour=13, minute=0, second=0)

if datetime.datetime.today() >= nighttime:
    var = 1 
if datetime.datetime.today() >= morntime and datetime.datetime.today() <= daytime:
    var = 2 
if datetime.datetime.today() >= daytime:
    var = 3
...
popup ("get:" + var)


The following code is found variable var, and I need it to apply a value dependent on the time of day.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.