2011-06-01 28 views

回答

12

你试过了吗?它适用于posix样式路径或mac样式路径,那么问题是什么?这不可能更容易。

set posixCalculatorPath to "/Applications/Calculator.app" 
set macCalculatorPath to (path to applications folder as text) & "Calculator.app" 

tell application posixCalculatorPath to activate 

delay 2 

tell application "Calculator" to quit 

delay 2 

tell application macCalculatorPath to activate 

你可能不知道该怎么做的一件事是找到你想要定位的应用程序的路径。我创建了一个找到的工具here,如果您将它提供给文件的路径,那么它将返回所有可打开该文件的应用程序的路径。所以这个结果会告诉你是否有多个具有相同名称的应用程序,然后你可以选择使用哪一个。

6
launch application ":Applications:TextEdit.app" 

tell application ":Applications:TextEdit.app" to launch