0
[JS] CS2: Search on a master page
New Here
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/td-p/1150526
Apr 17, 2008
Apr 17, 2008
Copy link to clipboard
Copied
(I'm still on CS2)
I have an auto page number on my master spreads. They're facing pages, so I have a left master page and a right master page. I want to find those two auto page numbers and apply a paragraph style to the one on the left page, and another style to the one on the right page.
My problem is using "search" for master spreads. If it were a "normal" page, I know I could do something like:
app.changePreferences.appliedParagraphStyle = 'Page Number R'
app.activeDocument.pages[0].search ("^#", false, false, "^#")
And it works. But for master spreads, I'm having difficulty using the search method. I've tried
app.activeDocument.masterSpreads('A-Master').pages(1).search ("^#", false, false, "^#")
and
app.activeDocument.masterSpreads[0].pages[1].search ("^#", false, false, "^#")
as well as a few other similar combinations. Obviously I'm missing something here. How do I search master page left and master page right?
Thanks,
Lisa
I have an auto page number on my master spreads. They're facing pages, so I have a left master page and a right master page. I want to find those two auto page numbers and apply a paragraph style to the one on the left page, and another style to the one on the right page.
My problem is using "search" for master spreads. If it were a "normal" page, I know I could do something like:
app.changePreferences.appliedParagraphStyle = 'Page Number R'
app.activeDocument.pages[0].search ("^#", false, false, "^#")
And it works. But for master spreads, I'm having difficulty using the search method. I've tried
app.activeDocument.masterSpreads('A-Master').pages(1).search ("^#", false, false, "^#")
and
app.activeDocument.masterSpreads[0].pages[1].search ("^#", false, false, "^#")
as well as a few other similar combinations. Obviously I'm missing something here. How do I search master page left and master page right?
Thanks,
Lisa
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150527#M278012
Apr 17, 2008
Apr 17, 2008
Copy link to clipboard
Copied
Shouldn't that be
app.activeDocument.masterSpreads.item('A-Master').pages(1).search ("^#", false, false, "^#")
Peter
app.activeDocument.masterSpreads.item('A-Master').pages(1).search ("^#", false, false, "^#")
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150528#M278013
Apr 17, 2008
Apr 17, 2008
Copy link to clipboard
Copied
... because #0 is the [None] master, right?
(I didn't figger that one out ...)
(I didn't figger that one out ...)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150529#M278014
Apr 17, 2008
Apr 17, 2008
Copy link to clipboard
Copied
>Shouldn't that be
>app.activeDocument.masterSpreads.item('A-Master').pages(1).search ("^#", false, false, "^#")
Of course not! It should be
app.activeDocument.masterSpreads.item('A-Master').pages.item(1).search ("^#", false, false, "^#")
That's the right-hand page, by the way, if you have two-sided masters. To search the left-hand page, use pages.item(0).
Peter
>app.activeDocument.masterSpreads.item('A-Master').pages(1).search ("^#", false, false, "^#")
Of course not! It should be
app.activeDocument.masterSpreads.item('A-Master').pages.item(1).search ("^#", false, false, "^#")
That's the right-hand page, by the way, if you have two-sided masters. To search the left-hand page, use pages.item(0).
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Lisa_Spike_
AUTHOR
New Here
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150530#M278015
Apr 18, 2008
Apr 18, 2008
Copy link to clipboard
Copied
>app.activeDocument.masterSpreads.item('A-Master').pages.item(1).search ("^#", false, false, "^#")
Actually, that is what I tried. I just typed incorrectly here in my post. To make sure, I tried again, and I get this error:
"app.activeDocument.masterSpreads.item().pages.item().search ("^#", false, false, "^#") is not a function"
Actually, that is what I tried. I just typed incorrectly here in my post. To make sure, I tried again, and I get this error:
"app.activeDocument.masterSpreads.item().pages.item().search ("^#", false, false, "^#") is not a function"
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150531#M278016
Apr 18, 2008
Apr 18, 2008
Copy link to clipboard
Copied
The flaw in this discussion is the assertion that searching pages is suported. It isn't. If it were, it would be on page 925 of the CS2 Scripting Reference.
Dave
Dave
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Participant
,
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150532#M278017
Apr 18, 2008
Apr 18, 2008
Copy link to clipboard
Copied
What happens if you try:
app.activeDocument.masterSpreads[0].pages[1].textFrames.everyItem().search("^#", false, false, "^#")
Hmm. What is that search supposed to be doing? You're not supposed to have wildcards in the change field in CS2.
Dave
app.activeDocument.masterSpreads[0].pages[1].textFrames.everyItem().search("^#", false, false, "^#")
Hmm. What is that search supposed to be doing? You're not supposed to have wildcards in the change field in CS2.
Dave
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Lisa_Spike_
AUTHOR
New Here
,
LATEST
/t5/indesign-discussions/js-cs2-search-on-a-master-page/m-p/1150533#M278018
Apr 18, 2008
Apr 18, 2008
Copy link to clipboard
Copied
Hi Dave,
I'm searching for an auto page number ("^#") and applying a paragraph style to it.
And "text frames" is what I was missing, it works now. Sorry, still learning how this all works.
You came to the rescue again. Thanks!
Lisa
I'm searching for an auto page number ("^#") and applying a paragraph style to it.
And "text frames" is what I was missing, it works now. Sorry, still learning how this all works.
You came to the rescue again. Thanks!
Lisa
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

