Sikuli script to know the idle application and close it

Asked by Pankaj on 2016-12-07

Is there any way in Sikuli that I can use to query the running but Idle application and if it is idle stop that process.

I am invoking an application(internal application) that in returns calls many other application to perform the testing. Once the application is done with processing , I would like to stop it and send the log. For this I need to understand if the application is idle or not. At the moment I am using

cmd = App.open(path to application);
 while cmd.isRunning():
     wait(1)

This waits for indefinite as application is running.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2016-12-07
Last reply:
2016-12-07
RaiMan (raimund-hocke) said : #1

You have to find something, that can be tested with SikuliX scripts, to detect the final idle state.

If your app has a GUI, you might find some visual situation in there, that you can check or wait for to happen.

another option might be, that you check the log file every 5 minutes for example, wether it is still growing using Python file features.

Or whatever - I do not know the behavior of your app.

Checking for an "idle state" is not available as a Windows/Java feature.

... or you might ask the developer of your "internal app" to add a feature, that it automatically stops, when all dependent apps have finished, which in turn would allow to use the above while xxx.isRunning.

Pankaj (pkmjee) said : #2

Yes my application has a GUI. When it becomes idle one of the button is enabled. I am using the enabled button inside wait to check if it has reached an idle state or not. See script below

cmd = App.open(path to application);
 while cmd.isRunning():
     wait(<enabled image>)
cmd.close();

In this case application is not getting closed when wait is over.

RaiMan (raimund-hocke) said : #3

Supposing it is on Windows.

All App features do not work as expected in every situation.

So if you are sure, that cmd.close() does not work, then you might try
App().close("part of window title")

If this does not work either, then the last option is to get the App somehow to the front and use
type(Key.F4, Key.ALT)

Can you help with this problem?

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

To post a message you must log in.