【发布时间】:2014-06-12 03:12:26
【问题描述】:
这个单行 Applescript 在我的 Mac 上运行良好:
tell application "Finder" to open POSIX file "/Development/Applescript/Rapport.docx"
但是它在一个琐碎的 ApplescriptObjC 项目中失败了:
on applicationWillFinishLaunching:aNotification
-- Insert code here to initialize your application before any files are opened
tell application "Finder" to open POSIX file "/Development/Applescript/Rapport.docx"
end applicationWillFinishLaunching:
我得到的错误是:
*** -[CMDAppDelegate applicationWillFinishLaunching:]: POSIX file "/Development/Applescript/Rapport.docx" of «script» doesn’t understand the “open” message. (error -1708)
我错过了什么?
【问题讨论】:
-
请注意,Finder 将使用默认设置为打开该文件的任何应用程序打开该文件(在 Finder 中,请参阅文件>获取信息>打开方式)。如果要在 Word 中专门打开文件以进行进一步操作,请使用
tell application "Microsoft Word" to open [whatever]。 (或者,如果您仅想从 ObjC 打开文件,则根本不需要 AS;请参阅 NSWorkspace 或 LaunchServices。)
标签: applescript applescript-objc