繁体   English   中英

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

[英]Open a local file with applescript within application

我如何从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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM