Enabled and disabled Button

Asked by Sreelekshmi on 2020-03-26

Is there a way to check a button whether its enabled or disabled . I have tried pattern("buttonEnabled").exact().Not working.

Using Sikuli1.1.4.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2020-03-27
Last query:
2020-03-27
Last reply:
2020-03-26
Best RaiMan (raimund-hocke) said : #1

imgOn = "enabled.png"
imgOff = "disabled.png"

m = <region containing the button>.findBest(imgOn, imgOff)
print m.getIndex(), m.getScore()
if m.getIndex() == 0:
    print "enabled"
else:
    print "disabled"

The details can be found in the docs

Sreelekshmi (sree2604) said : #2

Thank you so much Raiman. It works perfectly.