【问题标题】:Open a local file with applescript within application在应用程序中使用 applescript 打开本地文件
【发布时间】:2013-09-12 04:12:34
【问题描述】:

如何从 applescript 应用程序中打开文件?我会把它放在我的 applescript 应用程序的/Contents/Resources 中。我想知道的是我会告诉实际脚本做什么?

【问题讨论】:

    标签: macos applescript


    【解决方案1】:

    要获取应用程序的路径,请使用path to me 命令并构建资源路径。然后,您可以使用 Finder 使用默认程序打开文件,也可以告诉特定程序打开文件。

    set filepath to (path to me as string) & "Contents:Resources:file.ext"
    
    tell application "Finder"
        open alias filepath
    end tell
    
    --OR
    
    tell application "Microsoft Word"
        open alias filepath
    end tell
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-11
      相关资源
      最近更新 更多