0

我正在尝试在 Word 文档中组织修订。我显然错过了一些非常基本的东西,因为我不能走得太远。

以下脚本

tell application "Microsoft Word"

    set activeDoc to active document

    set revCount to count of revisions of activeDoc

    set aRev to first item of revisions of activeDoc

    set auth to author of aRev
    set when to date value of aRev

end tell

生成以下内容:

tell application "Microsoft Word"
    get active document
        --> active document
    count every revision of active document
        --> 1275
    get item 1 of every revision of active document
        --> current application
Result:
error "The variable aRev is not defined." number -2753 from "aRev"

错误发生在“set auth”引用上。我尝试了列表中的各种项目,结果相同。我还从字典中注意到文本范围可以包含修订,但即使范围跨越整个文档,我从它的修订计数中得到零。

4

1 回答 1

0

以下任何一项都可以解决眼前的问题:

set aRev to first revision of activeDoc

或者

set theRevs to the revisions of activeDoc
set aRev to the first item of theRevs

(我认为以下应该可以工作,但现在我忘记了为什么不这样做)

set aRev to the first item of (revisions of activeDoc)
于 2013-11-04T21:39:27.643 回答