2

这个单行 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)

我错过了什么?

4

1 回答 1

3

我曾经遇到过这个问题,我无法解释这种奇怪的行为,但一些重新安排对我有用:

tell application "Finder" to open "/Development/Applescript/Rapport.docx" as POSIX file
于 2014-04-26T15:26:09.900 回答