App.open() long resolve time

Asked by Thomas Slusser

New user to SikuliX, I have several programs I would like to open during automated testing. Opening these programs seems to lag for each declaration by 5-8 seconds. If I were to open them using the filesystem I know they would take much shorter to load, I am just curious if I have missed a setting that allows for faster resolve time for file paths.

For example
>>>paintpath = r'c:\WINDOWS\system32\mspaint.exe'
>>>paint = App(paintpath)

takes 5-8 seconds to load and any further application open declarations follow the same time - is there any way to reduce this?
Running on a Windows 10 implementation.

Thanks a million!

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

I just tested on Windows 10 with Java 11 on SikuliX 1.1.4:

start = time.time()
paintpath = r'c:\WINDOWS\system32\mspaint.exe'
paint = App(paintpath) # will not open the app, but detect if already open
print paint
paint.open() # this opens the app or uses already open app
print paint
print "Duration:", time.time() - start

you should read:
https://sikulix-2014.readthedocs.io/en/latest/appclass.html

I guess you are running the script from commandline.
If starting the app as a first action, you have to take into account the start-up time of about 3 - 5 seconds.

Look here for options how to run scripts from a masterscript, which would avoid the startup for the second and all other scripts.
https://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

There are some other options how to organize your stuff, so that you avoid the startup delay.

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

another script, that actively detects an already opened app

start = time.time()
paintpath = r'c:\WINDOWS\system32\mspaint.exe'
paint = App(paintpath)
if not paint.isRunning(0):
    print "not running"
    paint.open()
else:
    print "already running"
print paint
print "Duration:", time.time() - start

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

… forgot to mention, that the SikuliX overhead to open/focus/close an app is at about 0.5 seconds on average.

Can you help with this problem?

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

To post a message you must log in.