Similar Function App.waitVanish('someapp')

Asked by yop on 2018-02-15

Hello,

I am looking for a function like :
waitVanish("image.png", FOREVER)
but for a process or an application .....so llike this :-) :
App.waitVanish('someapp', FOREVER)

have you any idea for that function ?
Thanks for your feedback
Regards

Question information

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

already checked the observe feature?

yop (fraise) said : #3

Error is :
"AttributeError: type object 'App' has no attribute 'waitVanish'

Regards

RaiMan (raimund-hocke) said : #4

Already looked into the docs?

what about comment #1?

yop (fraise) said : #5

yes ...but i am not an expert :-)
I looked again the last docs "Sikulix 2014 - 01 2018" (very nice)
i wanted to try the function " "myApp.windows"

for exemple -1- with Firefox NOT starting and command "if not"
myApp = App('Firefox')
if not myApp.window():
      App.open ('gnome-terminal')
wait(1)
--> OK its Working a gnome-terminal Start

for exemple -2- whith Firefox STARTING and command "if"
myApp = App('Firefox')
for step in range (60):
if myApp.window():
      wait(1)
App.open ('gnome-terminal')
Not OK --> a gnome-terminal starting immediatly.

Regards

Best RaiMan (raimund-hocke) said : #6

myApp = App('Firefox')
for step in range (60):
    if not myApp.window():
        wait(1)
App.open ('gnome-terminal')

yop (fraise) said : #8

thanks for your reply.
It's looks exaclty i need !

It's looks Working whit FireFox.
My problem comme from whit an another app i lauch it by start a Gnome-Terminal and paste "LD LIBRARY PATH ....... ./myApp "
i think sikuli don't know "myApp" is lauched or not whit this method.

I need to try another method to lauch myApp.

Thanks RaiMan for the help you gave me!

yop (fraise) said : #9

Hello,

After some Holidays and few tests. For information the solution for me is the following script :
myApp=App('PathtoMyApp')
myApp.open()
wait(1)
for n in range (30): #time out at 30s
       if myApp.window() :
             wait(1)
       else : break
....
....

Whit this script during the loop of 30s, if i kill by myself the application " myApp", immediatly the loop stops to keep the script.

If i change "myApp.window()" by "myApp.isRunning()"
--> Its works if the application is stoped by Sikuli Script like "myApp.close()"
--> It doesnt work if i kill the application by myself
...i don't know if my explainations are so clear :-)

Thanks
Yopcitron

RaiMan (raimund-hocke) said : #10

Thanks for the information - very clear ;-)

I guess the problem is, that for Linux the App features are not all completely implemented - sorry for the inconvenience.

yop (fraise) said : #11

Thanks for your reply, your support and Sikulix !!!

yop (fraise) said : #12

Thanks RaiMan, that solved my question.