Back

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

Forum Replies Created

Viewing 15 posts - 76 through 90 (of 340 total)
  • Author
    Posts
  • in reply to: JavaScript for continuously numbering documents #1236574
    Peter Kahrel
    Participant

    Edward — In what way can you not get it to work? What have you tried? Do you see an error message? Does something happen but not what you expected? Does nothing happen at all? The script works on the first section of every open document. To target all sections in a single document, do this:

    app.documents[0].sections.everyItem().continueNumbering = true;

    And you could even target all sections in all open documents:

    app.documents.everyItem().sections.everyItem().continueNumbering = true;

    And, finally, in case you want to open all documents in a book, here’s another one-liner:

    app.open (app.activeBook.bookContents.everyItem().fullName);

    There are many one-liners!

    Peter

    in reply to: JavaScript for InDesign article Simple Script Runner #1236444
    Peter Kahrel
    Participant

    The Save dialog does indeed virtually look the same as the Open dialog. At first sight the difference is only in their titles, ‘Select a script’ vs. ‘Save the script’. On Windows (which I use) it works fine though:
    1. Click Save
    2. At the ‘File name:’ prompt, type a name for the script and click OK (or press Enter/Return). No need for a file type, .jsx is added automatically.

    I have some screen shots but I can’t show them here. I’ll send them to David.

    If neither of you can get it to work then it must be a Mac thing. In which case I’ll have to think of some fix.

    Peter

    in reply to: Delete everything before a character #1235394
    Peter Kahrel
    Participant

    Gopa’s solution works, and at the same time it’s a nice illustration of how useful GREP is. To delete amounts before the Euro symbol, do this:

    Find what: \d[\d.\x20]*?(?=€)
    Change to:

    In normal mortals’s words: ‘find a digit followed by any string of digits, dots and spaces, only if it/they is/are followed by the Euro symbol’.

    P.

    in reply to: HL Composer Optyca #14323082
    Peter Kahrel
    Participant

    app.documents[0].stories.everyItem().composer = “$ID/HL Composer Optyca”;

    in reply to: Get Selected Table Rows With ExtendScript? #14323319
    Peter Kahrel
    Participant

    This works: select an an insertion point in any cell, then do this:

    cell = app.selection[0].parent.parentRow.cells[0];
    table = cell.parent.parent;
    table.rows.itemByRange(cell,table.cells[-1]).select();

    In other words, select the rows from the first cell in the selected cell’s row to the table’s last cell.

    A convoluted and non-intuitive way to go about it, but there you are!

    Peter

    in reply to: I need a Script to apply for all Latin characters #14323349
    Peter Kahrel
    Participant

    It’s not entirely clear what you’re after. Please elaborate.

    in reply to: Make an array of H&J violations for processing with script #14323500
    Peter Kahrel
    Participant

    H&J violations aren’t exposed to scripting, you’ll have to go and look for them yourself. Which is possible, but it’ll be a slow script. To find violations in word spacing, for example, you first need the width of a space in a non-justified line of ext (typically the last line of a paragraph, or place a small temporary text frame, apply the paragraph style, enter a space, and measure its width. Then go through every line of text, measure the width of the first space and determine its scale compared with the standard space. Compare that with the minimum and maximum in the Justification panel.

    in reply to: Make an array of H&J violations for processing with script #14323523
    Peter Kahrel
    Participant

    That’s the way to do it.

    in reply to: Make an array of H&J violations for processing with script #14323527
    Peter Kahrel
    Participant

    H&J violations aren’t exposed to scripting, you’ll have to find them yourself. Which is possible, but it’s a slow bussiness. For example, to find word-spacing violations, you first find the width of a standard space (i.e. a space in a non-justified line of text). You then go through the text and in each line of text and get the width of the first space. Determine the percentage by which that space was scaled, then compare that percentage with the minimum and/or the maximum value set in the Justification panel.

    in reply to: Indexing from the Word List #14323542
    Peter Kahrel
    Participant

    You posted this in the Adobe’s InDesign forum as well. See the response there.

    p.

    in reply to: Script to Replace Existing Paragraph Styles With New Style #14323769
    Peter Kahrel
    Participant

    For a single document or a small handful of documents your method would certainly the recommended method, Jeremy. But when you have 1,000 files…

    Peter Kahrel
    Participant

    I’ll try again.

    (function () {
    var pstyles = app.activeDocument.allParagraphStyles;
    for (var i = 1; i < pstyles.length; i++) {
    if (pstyles[i].appliedFont.fontFamily == 'Arial') {
    pstyles[i].appliedFont = 'Roboco';
    }
    }
    }());

    Peter Kahrel
    Participant

    David — This script: https://www.kahrel.plus.com/indesign/batch_convert.html is a general batch processor. You can run a script with it as well, see the section ‘Run a script’ on that page.

    The script I posted above needs some changes before you can use it in the batch processor:

    (function () {
    var pstyles = app.activeDocument.allParagraphStyles;
    for (var i = 1; i < pstyles.length; i++) {
    if (pstyles[i].appliedFont.fontFamily == 'Arial') {
    pstyles[i].appliedFont = 'Roboco';
    }
    }

    }());

    Peter

    Peter Kahrel
    Participant

    You should leave out those
    tags. I couldn’t edit the code any longer after five attempts.

    Peter Kahrel
    Participant

    Something like the following script changes Arial to Roboto only in paragraphs that use Arial. Dependencies (through basedOn) should carry over. A potential problem is font styles in Arial not present in Roboco, But if you use just, say, Regular and Italic you should be ok. The proof of the pudding…

    pstyles = app.activeDocument.allParagraphStyles;<br />
    for (i = 1; i < pstyles.length; i++) {<br />
      if (pstyles[i].appliedFont.fontFamily == 'Arial') {<br />
        pstyles[i].appliedFont = 'Roboco';<br />
      }<br />
    }
    

    P.

Viewing 15 posts - 76 through 90 (of 340 total)