Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Create a automatic word Keyword check-list to run through page document

Hello everyone, 

I'm wondering if there is any way to create some sort of automatic Keyword check-list to run between pages.


Example: In document A (Called "SOURCE DOCUMENT KEYWORDS") I have identified around 50 keywords. After finishing writing an assignment (document B), I want to know whether in document B, there are some keywords that have already been identified in document A. If yes, then I would like them to be highlighted in document B.


MacBook Air 13″, macOS 10.15

Posted on Sep 19, 2020 10:27 AM

Reply
Question marked as Best reply

Posted on Sep 20, 2020 12:08 AM

A barebones script could be like this:


set keyWordsToHighlight to {"myKeyword1", "myKeyword2", "myKeyword3"}
tell front document of application "Pages"
	tell body text
		repeat with aKeyword in keyWordsToHighlight
			set color of (words where it is aKeyword) to "red"
		end repeat
	end tell
end tell



  1. Copy-paste into Script Editor (in Applications > Utilities).
  2. Add your keywords into the first line (each between quotes, and separated by commas)
  3. With your Pages document open click the triangle <run> button in Script Editor.


(If "nothing happens" make sure Script Editor is listed and checked at Security & Privacy > Privacy > Accessibility.)


Best to try on a duplicate of your document first.


SG

2 replies
Question marked as Best reply

Sep 20, 2020 12:08 AM in response to peymanfrommontreal

A barebones script could be like this:


set keyWordsToHighlight to {"myKeyword1", "myKeyword2", "myKeyword3"}
tell front document of application "Pages"
	tell body text
		repeat with aKeyword in keyWordsToHighlight
			set color of (words where it is aKeyword) to "red"
		end repeat
	end tell
end tell



  1. Copy-paste into Script Editor (in Applications > Utilities).
  2. Add your keywords into the first line (each between quotes, and separated by commas)
  3. With your Pages document open click the triangle <run> button in Script Editor.


(If "nothing happens" make sure Script Editor is listed and checked at Security & Privacy > Privacy > Accessibility.)


Best to try on a duplicate of your document first.


SG

Create a automatic word Keyword check-list to run through page document

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.