使用Applescript通过特定的完整路径“告诉”特定的应用程序

时间:2011-06-01 12:27:21

标签: applescript tell

我希望告诉应用程序“xyz”,但是通过指定应用程序的完整路径。这是因为系统上的应用程序可能存在不同版本,但名称相同。 如果可能的话?

2 个答案:

答案 0 :(得分:15)

你试过吗?它适用于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的工具,如果你将它提供给文件的路径,那么它将返回所有可以打开该文件的应用程序的路径。因此,结果会告诉您是否有多个具有相同名称的应用程序,然后您可以选择使用哪个。

答案 1 :(得分:7)

launch application ":Applications:TextEdit.app"

tell application ":Applications:TextEdit.app" to launch
相关问题