App.open() open exe file twice on windows 7. How to launch only one instance?

Asked by hxd86

Hi,

I am writing a automation test with sikulix package, 1.1.0-SNAPSHOT. When I try to launch the application, a exe file, with App.open(<path>) on Windows 7. It launches the application twice. Also, it seems every time I call the app.focus. It will launch a new instance of the application. Could some one tell me how to use it correctly?

In my class, I have

class {
App test;

public void launch(String arg1){
test.open(arg1);
}
}

Where arg1 will be the path.

Thank you in advance!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

this works on Win 7 for me:

    String pgmPath = "\"C:\\Program Files\\Microsoft Games\\Minesweeper\\MineSweeper.exe\"";
    App pgm = new App(pgmPath);
    pgm.open();
    RunTime.pause(2);
    pgm.focus();

Take care:
The program path has to obey the rules how it has to be specified on command line, which in this case means, that I have to add extra apostrophes before and after (need to be escaped of course), because the path contains blanks.

Revision history for this message
hxd86 (xdh1986) said :
#2

Thanks RaiMan, that solved my question.