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

InDesign scripting question re page numbers

Contributor ,
Dec 05, 2022 Dec 05, 2022

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
836
Translate
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. 

Translate
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. 

Translate
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

Hi Brian,

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

Translate
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

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

- Mark

Translate
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
LATEST

Hi Mark,

Thanks for the help, the linked discussion looks good 👍

Translate
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