0

In short:

with iWork rich text objects, breaking the text up in words goes from:

"This... he said, is a sentence!"

to:

["This", "he", "said", "is", "a", "sentence"]

So: periods, comma and exclamation point have disappeared. Similar to the AppleScript situation, but with Javascript for Automation it is unclear to me how to set the text item delimiter (plus: I am hoping it can be simpler than in the old days).

In detail:

I would like to modify rich text like:

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

The text can contain variations in size/color/weight, which should be kept. The result should be e.g.:

testing 123 units
etc.

When I go through the words (in my case: presenter notes in Keynote), I get:

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

instead of:

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

So: characters like ., [, and > don't show up, which makes it impossible to search/replace.

To get the words, I use:

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

I also tried using whose() in combination with ignoring/considering (case, hyphens, punctuation), but the result is the same.

How can I get a list of words that include the non-alphanumeric characters?

wivku
  • 2,457
  • 2
  • 33
  • 42
  • Did you figure this out? Did .....words actually give you the words? I've been trying to extract the presentationNotes and placing them in a txt file for about 2 days now, Can't seem to figure it out. – user1086377 Apr 28 '15 at 12:15
  • No, no progress. For your question: if you post it as a regular Stackoverflow question (and add comment here with link) then I can give you a code example that copies the presenterNotes (text only). – wivku May 01 '15 at 12:20
  • I did add write a question here: http://stackoverflow.com/questions/29908323/extract-presentationnotes-from-keynote thank you!!! – user1086377 May 01 '15 at 13:15
  • I have added a new question where I try to solve it with a different approach. That approach works great with TextEdit (attributeRuns), but attributeRuns does not seem to be available for Keynote. http://stackoverflow.com/questions/29989289/processing-richt-text-presenter-notes-in-keynote-using-javascript-for-automatio – wivku May 01 '15 at 15:00

1 Answers1

-1

To get the full text of a slide's notes, use the presenterNotes() method:

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

It's not exactly intuitive for me, but it works fine.

  • that was not the question. The question is (after reading the notes) how to process them word by word including the "...", "<<<", etc. And specifically (see follow up question): how to process the richtext nature of them (font/color/size). – wivku Aug 14 '16 at 12:09