how to close the current application with java code

Asked by jerry

I'm currently using java code to open and close my desktop application, seems App.close() does't work.

my code:

static string hitestpathstring="xxx//hitest.exe";
static App testApp=new App("hitest");

public static void openApp(){
testApp=App.open(hitestpathstring);
}

public static void closeApp(){
testApp=App.focus(hitestpathstring);
testApp.close():
}

the problem is: App.open() works but close() doesn't.

Any advice is appreciated, thanks 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

try:
App.close("some part of the window title")

or when the app has focus issue
type(Key.F4, Key.ALT)

Revision history for this message
jerry (jr-zhao) said :
#2

Thanks RaiMan, that solved my question.