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

[JS] CS2: Search on a master page

New Here ,
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
TOPICS
Scripting

Views

534

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 ,
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

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 ,
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 ...)

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 ,
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

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
New Here ,
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"

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
Participant ,
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

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
Participant ,
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

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
New Here ,
Apr 18, 2008 Apr 18, 2008

Copy link to clipboard

Copied

LATEST
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

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