Tag: applescript

AppleScript强制退出Java(JAR)程序?

你好, 我在MAC OS上运行Java(jar)应用程序。 我正在使用AppleScript来运行Java程序,它运行正常。 现在,我喜欢使用AppleScript来关闭Java程序。 我需要强制退出 Java程序。 我使用了以下AppleScript, set app_name to “NPC” set the_pid to (do shell script “ps ax | grep ” & (quoted form of app_name) & ” | grep -v grep | awk ‘{print $1}'”) if the_pid is not “” then do shell script (“kill -9 ” & the_pid) 运行Java程序的AppleScript称为“NPC.app”。当我运行“NPC.app”时,它在Activity Monitor应用程序上显示为NPC和NPC.npc 。 […]

Java ScriptEngineManager不再适用于Mountain Lion的AppleScript

自从我升级到Mountain Lion后,我无法通过Java ScriptEngineManager运行AppleScript代码。 在Apple的页面( 链接 )上找到的示例代码为engine对象返回null。 public static void main(String[] args) throws Throwable { String script = “say \”Hello from Java\””; ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName(“AppleScript”); engine.eval(script); } 有人知道任何变通方法吗?

Mac OS X 10.6上的Java AppleScript?

要从Python调用AppleScript,我使用“appscript”桥: http://appscript.sourceforge.net/ 在Mac OS X 10.6+上,我可以用什么方法从Java调用AppleScript?