Copy link to clipboard
Copied
Dear Friends.
I need your help:
My Requirements: How to match 1st line last character, 2nd line last characters and 3rd line last characters?
Example:
Last 1st line character >> a
Last 2nd line character >> a
Last 3rd line character >> a
My code below: (Not working)
var myDocument = app.activeDocument;
//~ var myLine = app.selection[0].lines;
var myLine = myDocument.stories.everyItem().paragraphs.everyItem().lines.everyItem().getElements();
for(i=0; i<myLine.length; i++)
{
var myChar;
if (String(myLine.characters.lastItem().contents).match(/\s/)){
myChar = myLine.characters.item(myLine.characters.length);
alert("String matches");
}
else{
myChar = myLine.characters.lastItem();
}
var myCharCon = myChar.contents;
alert(myCharCon)
if((String(myLine[2].characters.lastItem(-2)).charCodeAt (0).toString(16)).match(String(myLine[6].characters.lastItem(-2)).charCodeAt (0).toString(16))){
alert("String matches");
}
}
Please suggest friend
Thanks in Advance
KS
Copy link to clipboard
Copied
Dear Friend,
Any suggestion?
Thanks in Adcance
KS
Copy link to clipboard
Copied
Are you looking for a script that will show if there are three of the same characters at the end of three consecutive lines?
Copy link to clipboard
Copied
Hi SK,
Yes, you are right .
Thanks
Copy link to clipboard
Copied
Have you read the article at: https://indesignsecrets.com/free-script-identifies-word-stacks.php referenced in thread: Punctuation stack