0

I am trying to open Google chrome using OSX script to bring it to front. But I am getting the exception:

Application is background-only

Code is given below.

public void bringBrowserToFront() {
    try {
        String script = "tell app \"Google Chrome.app\" to activate";
        ScriptEngineManager mgr = new ScriptEngineManager();
        ScriptEngine engine = mgr.getEngineByName("AppleScript");
        engine.eval(script);
    } catch (ScriptException e) {
        System.out.println("oasscript error" + e.getLocalizedMessage());
    }
}

Could someone help on this.

Shamnad P S
  • 1,095
  • 2
  • 15
  • 43

1 Answers1

0

Because there will be problem in OSX scripting to open chrome. you will go directly through scripting without using exception e

Akash
  • 1
  • 1