Re: [Sikuli-driver] [Question #675931]: SikuliX script run on none active window

2018-11-06 Thread Nick Kho
Question #675931 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675931

Status: Answered => Solved

Nick Kho confirmed that the question is solved:
Yeh and I use the app.focus() function. The app I'll manually open it
and let it run while I multitask and do something else. However, once it
awhile while the script focus on the app it will interrupt my keyboard
input on my current task. But it works . Thanks a lot.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675972]: How to wait for Text field while page loading and type text when field is active.

2018-11-06 Thread monicar
Question #675972 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675972

Summary changed to:
How to wait for Text field while page loading and type text when field is 
active.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #675972]: How to wait for Text field while page loading and type text when field id active.

2018-11-06 Thread monicar
New question #675972 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675972

Is there any alternative to Thread.sleep in sikuli on page loading 

  public static void searchCreateNewDonor(String searchDonorText, Screen 
screen, Pattern searchDonor, Pattern select_CreateDonor) {

try {

Thread.sleep(2);
screen.wait(searchDonor, 10);
screen.type(searchDonor, searchDonorText);
screen.hover(select_CreateDonor);
screen.doubleClick(select_CreateDonor);

} catch (FindFailed findFailed) {
findFailed.printStackTrace();
} 

}



-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread matteoa
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

matteoa posted a new comment:
Thanks a lot Masuo!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread matteoa
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

Status: Answered => Solved

matteoa confirmed that the question is solved:
Thanks masuo, that solved my question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread masuo
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

masuo posted a new comment:
This is one of ideas for watchdog, please modify codes as what you want
to do.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread masuo
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

Status: Open => Answered

masuo proposed the following answer:
This script run continuously, if main script do not delay.

import thread
duration = 10
#-count down and type hotkey
def Type_Hotkey(name,*args):
global duration
while duration > 0:
duration = duration - 1
Do.popup("%d" % duration, "remaining time", 1)
type(Key.END,Key.CTRL) #type hotkey

#-hotkey handler
def Exit_Main(event):
type(Key.CTRL) #dummy type to cancel CTRL
exit()

#-Main script
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",""))

while True:
sleep(5)
duration = 10

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread matteoa
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

Status: Answered => Open

matteoa is still having a problem:
Hello Masuo,
thanks a lot for helping.
I tried to copy and paste your script directly in the 1.1.4 ide and run from 
there.
It closes the ide, and the java process that's running it.
I was expecting that the Ide wouldn't be closed
What I did wrong?
Thanks in advance
Matteo
I added some debug to understand better:
import thread
b=getBundleFolder()
Debug.setUserLogFile(b + "DebugSikuliX.log") 
Debug.user('getBundleFolder='+ b)

#-count down and type hotkey
def Type_Hotkey(name,*args):
Debug.user('Type_Hotkey='+ name)
cnt = args[0]
while cnt > 0:
cnt = cnt - 1
sleep(1)
type(Key.END,Key.CTRL) #type hotkey

#-hotkey handler
def Exit_Main(event):
Debug.user('Exit_Main')
type(Key.CTRL) #dummy type to cancel CTRL
exit()

#-Main script
Debug.user('Start')  
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
duration = 5
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",duration))
Debug.user('start_new_thread')  
while True:
sleep(1)
Debug.user('Stop')  


And this is the content of the corresponding debug file:
[user (06/11/18 11.23.35)] 
getBundleFolder=C:\TEst\sikulix\watchdogExample.sikuli\
[user (06/11/18 11.23.35)] Start
[user (06/11/18 11.23.35)] start_new_thread
[user (06/11/18 11.23.35)] Type_Hotkey=Type_Hotkey
[user (06/11/18 11.23.40)] Exit_Main

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread masuo
Question #675958 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675958

Status: Open => Answered

masuo proposed the following answer:
This is a way to use hotkey handler.

import thread
#-count down and type hotkey
def Type_Hotkey(name,*args):
cnt = args[0]
while cnt > 0:
cnt = cnt - 1
sleep(1)
type(Key.END,Key.CTRL) #type hotkey

#-hotkey handler
def Exit_Main(event):
type(Key.CTRL) #dummy type to cancel CTRL
exit()

#-Main script
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
duration = 5
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",duration))
while True:
sleep(1)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #675958]: How to implement a watchdog timer?

2018-11-06 Thread matteoa
New question #675958 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675958

hello all,
I have a Sikulix script that automate a sw that sometimes hangs or behave in 
unusual ways.
So far the script sometimes waits for the appearance of an image and if the 
image doesn't appears it remains like "stuck" and I have to stop the java 
process.
I'd like to implement a watchdog timer that when the internal status of the 
script is not updated for some time closes the script(or tries workaround).
I've checked on the net some options, like to put all the code in a try catch 
and then from a timer in a different thread raise an exception but I'd like to 
have something that doesn't force me to include all the script in such clauses.
Any idea?
Thanks for support and "have nice vacations to Raiman!"
Matteo

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp