← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #245020]: Sikuli sequencer

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Sorry, now docs available yet.

I made an example (with correct usage ;-)

Debug.setUserLogFile("/Users/rhocke/my-log.txt")
Settings.UserLogs = True # switch user logging on/off (default on)
Settings.UserLogPrefix = "my-log"; # define the prefix used for printing [user] … message ...
Settings.UserLogTime = True; # add time stamp on/off (default on) - [user timestamp] … message …

img = "some-image.png"
click(img)
Debug.user("clicked %s at %s", img, atMouse())

the file /Users/rhocke/my-log.txt contains:
[my-log (06.03.14 13:53:34)] clicked some-image.png at L(277,925)@S(0)[0,0 1920x1200]

so you are able to create a log file, that only contains, what you are
logging using Debug.user().

You might even create small functions, to hide the logging:

def clickLog(image, reg = SCREEN):
    reg.click(image)
    Debug.user("clicked %s at %s", image, atMouse())

and use it:
clickLog(img) # searches the whole screen

or 
clickLog(img, some_region) # only search in some_region 

… and if you use def's like this, you might even put the FindFailed
handling in there.

Hope it helps.

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