【问题标题】:Applescript to launch file from current folder?Applescript从当前文件夹启动文件?
【发布时间】:2011-08-09 22:16:20
【问题描述】:

如何打开 AppleScript 代码所在文件夹中的文件?类似的东西?

tell application "QuickTime Player"
    activate
    open "file.avi"
end tell

(这不起作用)。 谢谢!

【问题讨论】:

    标签: applescript


    【解决方案1】:
    tell application "Finder"
        open file "somefile.txt" of folder of (file (path to me))
    end tell
    

    (仅在您保存脚本后才能使用 - 否则“我的路径”将转到脚本编辑器)

    【讨论】:

    • 太棒了。 file 之前的 path to me 不需要,但(至少从 OS X 10.8 开始) - path to me 返回一个 alias,其 folder(或 container)属性可以直接查询。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多