Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 15 posts - 286 through 300 (of 340 total)
  • Author
    Posts
  • in reply to: GREP Replace Metacharacters #81678
    Peter Kahrel
    Participant

    A. — This does doesn’t work in InDesign. Several feature requests have been submitted without much effect (please add your own).

    One workaround, if the font you use has All Caps, is to look for ^ and apply allcaps.

    The other workaround is a script, which can be very simple in principle:

    app.findGrepPreferences = null;
    app.findGrepPreferences.findWhat = '^l';
    found = app.selection[0].findGrep();
    for (i = 0; i < found.length; i++) {
      found[i].contents = found[i].contents.toUpperCase();
    }

    This targets the current selection. To target the document, replace app.selection[0] with app.activeDocument in line 3.

    in reply to: GREP Help! #81553
    Peter Kahrel
    Participant

    Look for \$$
    which stands for ‘Dollar symbol at the end of a line’.

    \$ matches the Dollar symbol, the following $ stands for ‘end of the line/paragraph’.

    Peter

    in reply to: Find and change only on odd or even pages #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

    in reply to: Find and change only on odd or even pages #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?

    in reply to: Find and change only on odd or even pages #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?

    in reply to: script needed to remove background colour #81206
    Peter Kahrel
    Participant

    Here’s a wrapper to deal with books. Make sure there’s an open book, then run the script. The script opens, processes, and closes the book documents one by one.

    (Hope you don’t feel I’ve hijacked your script, Keith.)

    (function () {
    
      function removeBackgrounds (myDoc) {
        var myRectangleArray = myDoc.rectangles.everyItem().getElements();
        for (var j = myRectangleArray.length-1; j >= 0; j--) {
          var myItem = myRectangleArray[j];
          if ((myItem.graphics.length > 0 ) || (myItem.images.length > 0)) {
            myItem.fillColor = myDoc.swatches.item("None");
          }
        }
      }
      
      var chapters = app.activeBook.bookContents.everyItem().getElements();
      for (var i = 0; i < chapters.length; i++){
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
        app.open (chapters[i].fullName);
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
        removeBackgrounds (app.activeDocument);
        app.activeDocument.close (SaveOptions.YES);
      }
    
    }());
    in reply to: script needed to remove background colour #81185
    Peter Kahrel
    Participant

    It was and it wasn’t the space between the – and the 1: the forum software replaced [space]-[space] to [space]en-rule[space].

    To run a script against all book documents, you could use the method described here:
    https://forums.adobe.com/thread/2069523
    See the first post by Vamitul.

    in reply to: script needed to remove background colour #81180
    Peter Kahrel
    Participant

    There was another instance where the forum software tried to be ‘clever’. Change the curly quotes at None to straight quotes.

    in reply to: script needed to remove background colour #81156
    Peter Kahrel
    Participant

    Paul,

    The forum software played a trick on Keith’s script. In this line:

    for (var j = myRectangleArray.length – 1; j >= 0; j–) {

    the two minuses in j-- were replaced by an en-rule. Line 3 should be

    for (var j = myRectangleArray.length – 1; j >= 0; j--) {

    Peter

    in reply to: Find and change only on odd or even pages #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

    Peter Kahrel
    Participant
    oStyle.enableTextFrameAutoSizingOptions = true;
    oStyle.textFramePreferences.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;

    You should learn how to use the object-model viewer, either the one built into the ESTK or one of the object-model viewers available on the web.

    Peter

    Peter Kahrel
    Participant

    Marcin,

    Folder.selectDialog();

    returns a Folder object, not a string.

    P.

    in reply to: FIT TextFrame to it's Contents by Java Script #81040
    Peter Kahrel
    Participant

    Thanks, Keith. I’d forgotten that you need to click the handles, not just the frames.

    On text frames, FitOptions.FRAME_TO_CONTENT fits the frame vertically only, just like when you select that option in the interface (or press Ctrl+Alt+C or its Mac equivalent). Double-clicking the left- or right-hand handle fits the frame horizontally, but often breaks lines on its own accord, which is not what you want.

    P.

    Peter Kahrel
    Participant

    If you plan to do any file handling, do read the chapter ‘File system access’ in the JavaScript Tools Guide. Start the ESTK, go to the Help menu, click ‘JaveScripts Tools Guide CC’.

    Peter

    Peter Kahrel
    Participant
    myDocument.save (File('ZZZZ/yyyy.indd'));

    P.

Viewing 15 posts - 286 through 300 (of 340 total)