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

Mat*_*zer 16 applescript tell

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

reg*_*633 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
Run Code Online (Sandbox Code Playgroud)

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


小智 7

launch application ":Applications:TextEdit.app"

tell application ":Applications:TextEdit.app" to launch
Run Code Online (Sandbox Code Playgroud)