Ms word 有没有办法在MacWord2011中用Applescript获取段落开头的页码?

Ms word 有没有办法在MacWord2011中用Applescript获取段落开头的页码?,ms-word,applescript,Ms Word,Applescript,我有一个Word文档,希望获取文档中任意段落的页码。我意识到段落可以跨越页面,所以我实际上需要询问段落的开头(或结尾)。类似这样的伪代码: set the_page_number to page number of character 1 of paragraph 1 of my_document 我还没有弄清楚如何将一个范围对象与其渲染相关的任何类型的信息链接起来,我官方对此感到困惑 有人知道正确的方法吗?我在C#中发现了这个问题: 翻阅答案,我找到了对range.get\u信息(Word.

我有一个Word文档,希望获取文档中任意段落的页码。我意识到段落可以跨越页面,所以我实际上需要询问段落的开头(或结尾)。类似这样的伪代码:

set the_page_number to page number of character 1 of paragraph 1 of my_document
我还没有弄清楚如何将一个范围对象与其渲染相关的任何类型的信息链接起来,我官方对此感到困惑


有人知道正确的方法吗?

我在C#中发现了这个问题:

翻阅答案,我找到了对
range.get\u信息(Word.WdInformation.wdActiveEndPageNumber)

事实证明,applescript字典中有一个
get range information
命令,因此您可以执行以下操作:

set the_range to text object of character 1 of paragraph 123 of the_document
set page_number to get range information the_range information type active end adjusted page number
这将得到要打印的页码(例如,如果您将文档设置为从第42页开始,这将生成您期望的页码)。或者,您可以无需调整即可获得编号,即您的文档页码设置为从42开始,但您希望页码如同编号从1开始一样

set the_range to text object of character 1 of paragraph 456 of the_document
set page_number to get range information the_range information type active end page number