← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #270104]: Script runs simultaneous with hotkey function

 

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

masuo posted a new comment:
What you want to do, I think that the following.
I'm sorry I was wrong.

-------------------
def pause_unpause_script(event=None):
    global PAUSED
    PAUSED = not PAUSED


Env.addHotkey(Key.F1, KeyModifier.CTRL, exit_script)
Env.addHotkey(Key.PAUSE, 0, pause_unpause_script)

logger = setup_logger(file_name="C:\\test.log")

i = 0
while True:
    global PAUSED

    if PAUSED:
        logger.info('Pausing script...Press Pause to unpause...')
        sleep(10)
    else:
        logger.info('Unpausing script...Press Pause Lock to pause...')

    if i >= 25:
        break
    i += 1
    logger_step = "Step: %s" % intWithCommas(i)
    logger.info(logger_step)
    sleep(2)

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