Macos 在应用程序中使用applescript打开本地文件

Macos 在应用程序中使用applescript打开本地文件,macos,applescript,Macos,Applescript,如何从applescript应用程序中打开文件?我会把它放在applescript应用程序的/Contents/Resources中。我想知道的是我会告诉实际脚本做什么?要获取应用程序的路径,请使用path to me命令并构建到资源的路径。然后,您可以使用Finder用默认程序打开文件,也可以告诉特定程序打开文件 set filepath to (path to me as string) & "Contents:Resources:file.ext" tell applicatio

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

要获取应用程序的路径,请使用
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