How to handle unexpected alert?

Asked by Veronika

How should I handle unexpected alert?
Actually I couldn't find anything about alerts here: http://sikulix-2014.readthedocs.org/en/latest/sikuli-script-index.html

I need do something like this:

if(Alert)
   do something
else
  do something else

Mac os 10.8.5. Sikuli v. 1.0.1

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

what do you mean by Alert?

Some popup, that comes up accidentally and might crash the given workflow by e.g. hiding something?

Revision history for this message
Veronika (norika1111) said :
#2

Yes. For example keychain popup which appears on first start. Or any other popups (alerts) in application, like "Would you like save a file?" ect. I can specify exact popup text so I need a default handler. And click a default button.

Revision history for this message
Veronika (norika1111) said :
#3

Sorry, i meant i can't specify popup text.

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

ok, understood.

There is no general solution for these "asynchronous" (means: cannot be foreseen in the sense of a workflow) popups, because:
- not all popups have the same visual aspects, only some "families" (e.g. same icon or other visual aspects)
- since mouse and keyboard usage have to be coordinated, the concrete solution depends on what Sikuli workflows run in parallel

The most general solution is to run an observe in background and handle the specific poup, when it appears. one observe might handle more then one event and you might even dispatch more than one observe.
Beginning with version 1.1.0 at least the mouse usage can be synchronized between the main workflow thread and the dispatched observers running in their own threads.

Until including 1.0.1 especially the mouse usage might be mangled. And generally the main workflow might run into a problem, before the popup is handled (this timing aspect is very hard to attack).

As generally for Sikuli, the more the observation can be restricted to specific areas on the screen, the less cpu load.
Using ObserveScanRate one can control how often observe checks the appearances.

Can you help with this problem?

Provide an answer of your own, or ask Veronika for more information if necessary.

To post a message you must log in.