← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #244467]: Is that healthy to write long commands?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Both options are ok and have their pro's and con's

*** option 1 (line by line)
you would use this normally during workflow design and testing and of course, if you need the intermediate regions later in the workflow.
On crash, you get the causing line as a more detailed feedback, than with option 2.

Wether you convert option1 code to option2 code after it works depends
on your needs.

BTW: in version 1.0.1+ you have Settings.Highlight=True for debugging
purposes, so every match is highlighted for 2 secs
(Settings.DefaultHighlightTime=N (value >= 1).

So for testing purposes this would be enough:
Settings.Highlight=True
pat = find("pattern.png")
patR = pat.right()
but = patR.find("button.png")
but.click()

... and if it works, simply switch to  False

*** option 2 (dotted chain)
... surely has the advantage, that it can be read and understood similar to a sentence in natural language.
... and it makes the scripts shorter

But it makes debugging a bit harder.

Again the "highlight" version
Settings.Highlight=True
find("pattern.png").right().find("button.png").click()

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