“告诉”通过使用AppleScript特定的完整路径特定的应用程序 [英] 'telling' a specific application by a specific full path using Applescript

查看:301
本文介绍了“告诉”通过使用AppleScript特定的完整路径特定的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待告诉应用程序XYZ,而是通过指定应用程序的完整路径。这是因为有可能在系统中不同位置上的应用程式的各种版本,但具有相同的名称。
如果这可能吗?

I am looking to tell application "xyz", but by specifying a full path to the application. This is because there may be various versions of the app on the system in different places, but with the same name. If this possible?

推荐答案

你试过了吗?它与无论是POSIX风格的路径或Mac风格的路径,所以有什么问题?这再简单不过了。

Have you tried it? It works with either a posix style path or mac style path, so what's the issue? It couldn't be easier.

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

一件事,你可能不知道如何做的是找到的路径,要针对应用程序。我创建了一个工具,发现这里,如果你给它的路径到文件,然后它的路径返回到所有可能打开该文件的应用程序。这样的结果会告诉你,如果有多个应用程序具有相同的名称,然后你可以选择使用哪一个。

One thing that you might not know how to do is to find the path to the application you want to target. I have created a tool found here which, if you feed it the path to a file then it will return the paths to all of the applications that could open that file. So that result would tell you if there is multiple applications with the same name and then you could choose which one to use.

这篇关于“告诉”通过使用AppleScript特定的完整路径特定的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆