Find and change only on odd or even pages

Learn / Forums / General InDesign Topics / Find and change only on odd or even pages

Viewing 16 reply threads
  • Author
    Posts
    • #70141

      Hi,

      Does anyone know of a plugin, script, or even a way in InDesign itself, to allow a find/change to affect only odd or even (left or right) pages only.

      Cheers

      b.

    • #70144
      David Blatner
      Keymaster

      Hm. Can’t think of anything off the top of my head, sorry.

    • #70147

      I can style sheet everything then search choosing the style sheet, but this is a bit messy and you have to preplan everything.

      Another option would be to get a javascript to turn all text on odd (or even) numbered pages green (for example), then use this as the filter. The script could turn text back to black after.

      Have you come across a script that can change text depending on page number David?

      Cheers

      Bill

    • #70149
      David Blatner
      Keymaster

      Nope.
      Maybe put the objects on different layers, then lock the layers when doing find/change?

    • #70163
      Eugene Tyson
      Member

      Amazing – Find Change won’t work on a locked text frame – but spell check will still check locked frames.

      Think the OP just needs a script to lock odd pages or lock even pages.

    • #80502
      Bart Eenkhoorn
      Participant

      I have the same need and posted it here the other day: https://creativepro.com/topic/findchange-on-left-or-right-page-only
      Have you come across a solution already Bill? Or are we looking at one of the few things that Indesign cannot do?

    • #81150

      Nothing so far. :(

      I guess you could write an applescript that selected text frames on odd / even (left /right) pages and gave each frame a standard object style, then search within those.

    • #81155
      Peter Kahrel
      Participant

      Here is a general template for targeting left- or right-hand pages. This particular example underlines numbers on left-hand pages. Change LEFT_HAND to RIGHT_HAND to target rectos. Make other changes as needed in lines 4 and 9.

      (function () {
        app.findGrepPreferences = null;
        app.findGrepPreferences.findWhat = '\\d+';
        var found = app.activeDocument.findGrep();
        for (var i = found.length-1; i >= 0; i--) {
          if (found[i].parentTextFrames.length > 0 && found[i].parentTextFrames[0].parentPage.side === PageSideOptions.LEFT_HAND) {
            // i.e. not overset and on a recto
            // Do something, e.g.
            found[i].underline = true;
          }
        }
      }());

      Peter

    • #81181

      I’ll give this a go. Thanks Peter :)

    • #81205
      Bart Eenkhoorn
      Participant

      I will try this as well. Thanks in advance Peter, much appreciated.

    • #81207
      Bart Eenkhoorn
      Participant

      Just tried it, produces error 23, String: does not have a value, line 5: offending Text: =
      for (var i = found.length-1; i >= 0; i–) {

      Does that mean that the script thinks my document does not have textframes? I am using a 14 page document with a textframe on each page. I am just a cut-and-paste javascript user, so I have no clue what can cause the error.

    • #81232
      Peter Kahrel
      Participant

      I’ve no idea what goes wrong at your end. Works fine here with a variety of texts. What does your text look like, and what are you looking for?

    • #81233

      I too am getting a JavaScript Error
      I named the javascript z.Find_Change_LH.jsx and this is the error. Any ideas?

      Error Number: 21
      Error String: null is not an object

      Engine: main
      File:/Applications/Adobe InDesign CC 2014/Scripts/Scripts Panel/ Samples/JavaScripts/z.Find_Change_LH.jsx

      Line: 6
      Source: if (found[i].parentTextFrames.length > 0 && found[i].parentTextFrames[0],parentPage.side === PageSideOptions.LEFT_HAND) {

    • #81235
      Peter Kahrel
      Participant

      Bill, B. Eenkhoorn — the script clearly runs into a situation that I’m unaware of. Can you post your documents so that I can have a look?

    • #81293
      Bart Eenkhoorn
      Participant

      Here is a link to the (working) document Peter:
      https://goo.gl/VT2CqU
      For the right-side pages I want the verse numbers to move to the right side of the page. So if I could find/change the right-side object styles separate from the left page ones, I can then change these object styles to move to the right side.
      Thanks in advance for your help,
      Bart

    • #81297
      Peter Kahrel
      Participant

      Bart,

      I see the problem. What you find is in an anchor, so the script should do the sidedness test a bit differently.

      But for what you want to achieve you don’t need a script at all: in the object-style window, in the Anchored Object Options panel, there’s a checkbox ‘Relative to spine’. Check that box and all your anchored v_margin frames will appear on the left-hand side of the main text on left-hand pages and on the right-hand side of the main text on right-hand pages.

      Hartelijke groet,

      Peter

    • #81298
      Bart Eenkhoorn
      Participant

      Ah, this is great, and how could I have missed that. Dank je wel Peter.
      Bart

Viewing 16 reply threads
  • You must be logged in to reply to this topic.
>