popAsk return different values when run from command line --- workaround we have to live with

Asked by masuo on 2018-04-03

Confirmed: On Mac in all cases, On Windows as mentioned only when running scripts from command line.

workaround: use spacebar instead of enter, which works in all cases.

Seems to be problem with the underlying Java GUI element.

------------------------------------------------------------------------------------------------------------

When run script from command line and I push Enter key, popAsk return True even if focus is [No] button.
When run script from SikuliX IDE and I push Enter key, popAsk return False if focus is [No] button.

[Operation1]
When popAsk window open, focus is [Yes] button.
After push Tab key, focus is [No] button.
Then push Enter key, popAsk return True.

[Operation2]
When popAsk window open, focus is [Yes] button.
Then click [No] button, popAsk return False.

[Environment]
SikuliX IDE 1.1.1
Java 1.8.0_161
Windows7

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-04-03
Last query:
2018-04-03
Last reply:
2018-04-03
masuo (masuo-ohara) said : #1

Both [Operation 1] and [Operation 2] are procedures and phenomena when I have run script from the command line.

[script codes]
ans = popAsk("Do you continue?")
popup( "%s" % ans)

Best RaiMan (raimund-hocke) said : #2

Is this on Mac?

If yes, I cannot find any difference in behaviour between IDE and command line.

When using tab to switch focus to "No", then you have to use the space key to trigger the selected button.
Using enter always triggers the default key ("Yes" in this case

masuo (masuo-ohara) said : #3

Thanks RaiMan, that solved my question.