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

InDesign scripting question re page numbers

Contributor ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Hi everyone,

Please can someone helpo me...

I have a grep find set up in a script and all works fine.

Just wondered if it's possible to get the page number of each instance returned by the grep find?

Thanks in advance.

TOPICS
How to , Scripting

Views

452

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

correct answers 1 Correct answer

Community Expert , Dec 05, 2022 Dec 05, 2022

Grep find typically returns a Text object. From there, you can get myFind.parentTextFrames[0].parentPage. Note that if the item is on the pasteboard, parentPage is null. Or if it extends across multiple text frames those frames might be on different pages. 

Votes

Translate

Translate
Community Expert ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Grep find typically returns a Text object. From there, you can get myFind.parentTextFrames[0].parentPage. Note that if the item is on the pasteboard, parentPage is null. Or if it extends across multiple text frames those frames might be on different pages. 

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

Hi Brian,

Thanks for the help, I'll give that a go 👍

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
Community Expert ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

For an example implementation of what @brianp311 described, see this post (search for "function textPage").

- Mark

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 ,
Dec 05, 2022 Dec 05, 2022

Copy link to clipboard

Copied

LATEST

Hi Mark,

Thanks for the help, the linked discussion looks good 👍

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