sikuli does not work in windows taskscheduler when the system is locked

Asked by karthicm+sikuli@amazon.com

I have a sikuli script which basically opens a URL and saves it as .htm and I have scheduled to run every day using windows task scheduler using a .bat file.

The scheduler triggers the event but sikuli does not work if the system is locked.

Here is my .bat file:
@echo off
start C:\Save_DashBoard.skl

This is my sikuli script.

from sikuli.Sikuli import *
import datetime
now = datetime.datetime.now()
ReportDate = now.strftime("%Y-%m-%d")
WaitSeconds= 300
WaitMaxSeconds = 1000
ImagePath = "C:\\ImageRepository\\"
if not ImagePath in sys.path:
    sys.path.append(ImagePath)
setBundlePath(ImagePath)
PageLoadComplete = ImagePath+"PageLoad_Google.png"
AddressBar = ImagePath+"AddressBar.png"
AddressBar_1 = ImagePath+"AddressBar_1.png"
GraphLoad = ImagePath+"GraphLoad.png"
DashBoardURL = "<URL>"
DashBoardLocale = "JP"
FilePath="C:\\Users\\<USER>\\Documents\\Dashboard_HTML\\"
try:
    keyUp()
    App.focus(r"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
    wait(2)
    type(" ",KEY_ALT)
    type("x")
    if exists(AddressBar):
        wait(AddressBar,WaitSeconds)
        wait(PageLoadComplete,WaitSeconds)
        wait(AddressBar,WaitSeconds)
        click(AddressBar)
    else:
        type("d",KEY_ALT)
    type(DashBoardURL)
    type(Key.ENTER)
    if exists(GraphLoad):
        wait(GraphLoad,WaitMaxSeconds)
        waitVanish(GraphLoad,WaitMaxSeconds)
    else:
        sleep(60)
    type("s",KEY_CTRL)
    type(FilePath + DashBoardLocale + "_Dashboard_" + ReportDate)
    type(Key.ENTER)
    sleep(60)
    type("y",KEY_ALT)
except:
    print "Error!!! Exception occured!!!"
finally:
    App.close("Mozilla Firefox")
    exit(1)

This is working if the system is not locked.

When the system is locked all the HOT keys does not work.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

That is a "feature": Sikuli needs the real screen containing what the script is looking for. Even if some app might run behind a locked screen, Sikuli cannot act on its GUI, since it is not visible.

So you have to somehow unlock the machine to get your script working.

Revision history for this message
Naresh (naresh-shenishetty) said :
#2

Hi,

I am running sikuli script on Android emulator both are on VM machine, test cases failing when screen is locked.
Is there any work around for the resolution.

Thanks,
Naresh

Revision history for this message
RaiMan (raimund-hocke) said :
#3

@ Naresh
see comment #1

Can you help with this problem?

Provide an answer of your own, or ask karthicm+sikuli@amazon.com for more information if necessary.

To post a message you must log in.