• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Match last line characters

Contributor ,
Aug 23, 2016 Aug 23, 2016

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

TOPICS
Scripting

Views

509

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 23, 2016 Aug 23, 2016

Copy link to clipboard

Copied

Dear Friend,

Any suggestion?

Thanks in Adcance

KS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 23, 2016 Aug 23, 2016

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 23, 2016 Aug 23, 2016

Copy link to clipboard

Copied

Hi SK,

Yes, you are right .

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 23, 2016 Aug 23, 2016

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines