【问题标题】:'telling' a specific application by a specific full path using Applescript使用 Applescript 通过特定完整路径“告诉”特定应用程序
【发布时间】:2013-03-30 01:43:50
【问题描述】:

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

【问题讨论】:

    标签: applescript tell


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:
      launch application ":Applications:TextEdit.app"
      
      tell application ":Applications:TextEdit.app" to launch
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-28
        • 2018-01-13
        相关资源
        最近更新 更多