Skip to main content
Jo_2013
Known Participant
November 14, 2016
Question

this.getPageNthWord using space or carriage return between words

  • November 14, 2016
  • 1 reply
  • 415 views

I have a script which loops for a total of 8 words.

The fourth word can be separated by a space in some instances or a carriage return (Paragraph mark) in other instances.

The script is not working, if anyone can help modify the highlighted part of the script for the OR OPERATOR that would be most appreciated.

numWords = this.getPageNumWords(0);

for (var j = 0; j < numWords-1; j++)

{

ckWords8 = this.getPageNthWord(0, j) + ' ' + this.getPageNthWord(0, j + 1) + ' ' + this.getPageNthWord(0, j + 2) + ' ' + this.getPageNthWord(0, j + 3) + '\n' || ' ' + this.getPageNthWord(0, j + 4) + ' ' + this.getPageNthWord(0, j + 5) + ' ' + this.getPageNthWord(0, j + 6)  + ' ' + this.getPageNthWord(0, j + 7);

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 14, 2016

You can only include the OR operator inside of a condition. It has no meaning in the context you used it.

So combine the words into ckWords8 and then at the end use something like this:

if (ckWords8=="phrase 1" || ckWords8=="phrase 2") { ... }