0

简而言之:

使用 iWork 富文本对象,将文本分解为单词来自:

“这……他说的,是一句话!”

至:

[“这”、“他”、“说”、“是”、“一个”、“句子”]

所以:句号、逗号和感叹号都消失了。类似于AppleScript 的情况,但是对于自动化的 Javascript,我不清楚如何设置文本项分隔符(另外:我希望它可以比过去更简单)。

详细地:

我想修改富文本,如:

testing [value] units <ignore this>
>>>
also ignore this
<<<
etc.

文本可以包含大小/颜色/重量的变化,应该保留。结果应该是例如:

testing 123 units
etc.

当我浏览这些单词时(在我的例子中:Keynote 中的演讲者笔记),我得到:

["testing", "value", "units", "ignore", "this", "also", "ignore", "this", "etc"]

代替:

["testing", "[value]", "units", "<ignore", "this>", ">>>", "also", "ignore", "this", "<<<", "etc."]

所以:像 .、[ 和 > 这样的字符不会出现,这使得搜索/替换变得不可能。

为了得到这些词,我使用:

words = Application("Keynote").documents[0].slides[0].presenterNotes.words

我还尝试将 who() 与忽略/考虑(大小写、连字符、标点符号)结合使用,但结果是一样的。

如何获取包含非字母数字字符的单词列表?

4

1 回答 1

-1

要获取幻灯片注释的全文,请使用以下presenterNotes()方法:

note = Application("Keynote").documents[0].slides[0].presenterNotes()

这对我来说并不完全直观,但它工作正常。

于 2015-12-08T20:49:45.353 回答