Back

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

Forum Replies Created

Viewing 7 posts - 46 through 60 (of 332 total)
  • Author
    Posts
  • in reply to: Script or Plugin to Flag Certain Words #14394816
    Peter Kahrel
    Participant

    Thanks for the write-up, Mike!

    The script could be improved a bit. If you add and/or remove any words from the word list and run the script again, it doesn’t remove the highlights of the words that are no longer high risk. It’s a simple addition, let me know if you’re interested in the update.

    in reply to: Script or Plugin to Flag Certain Words #14394758
    Peter Kahrel
    Participant

    Glad you liked it! Conditional text is very useful, though I never use it as conditional text, only ever to highlight various bits of text. One thing I use it for was mentioned by Matt in the article you mentioned, to highlight references to figures, maps, tables, etc.

    in reply to: Script or Plugin to Flag Certain Words #14394741
    Peter Kahrel
    Participant

    Marc’s excellent script doesn’t mark up words. But a script to highlight words in a text isn’t too hard.

    First, create a text file that contains all your risk words and save it in the document’s folder under the name risk-words.txt

    Then run the below script. It creates a text condition and applies that condition to all the risk words. The advantage of txt conditions is that they don’t show in print (or PDF), or in InDesign’s Preview mode.

    
    (function () {
      var condition;
      var riskWords;
    
      function getCondition () {
        app.documents[0].conditionalTextPreferences.showConditionIndicators = 
          ConditionIndicatorMode.SHOW_INDICATORS;
        var c = app.documents[0].conditions.item('Risk word');
        if (!c.isValid) {
          c = app.documents[0].conditions.add ({
            name: 'Risk word', 
            indicatorColor: UIColors.YELLOW, 
            indicatorMethod: ConditionIndicatorMethod.useHighlight
          });
        }
        return c;
      }
    
      function highlight (word) {
        app.findTextPreferences.findWhat = word;
        var w = app.documents[0].findText();
        for (var i = w.length-1; i >= 0; i--) {
          w[i].applyConditions (condition);
        }
      }
     
      function getWords () {
        var f = File (app.documents[0].filePath + '/risk-words.txt');
        if (f.exists) {
          f.encoding = ('utf-8');
          f.open('r');
          var w = f.read().split(/[\r]/);
          f.close();
          return w;
        }
        return null;
      }
     
      app.findTextPreferences = app.findChangeTextOptions = null;
      app.findTextPreferences.properties = {
        caseSensitive: false,
        wholeWord: true,
        includeLockedStoriesForFind: false,
      }
     
      condition = getCondition();
      riskWords = getWords();
      if (!riskWords) {
        alert ('Risk words not found');
        exit();
      }
     
      for (var i = riskWords.length-1; i >= 0; i--) {
        highlight (riskWords[i]);
      }
     
    }());
    
    Peter Kahrel
    Participant

    Just for the record: I sent Jim the sample document and the script, and now it’s available here

    Peter Kahrel
    Participant

    Jim: Endnotes keyed to phrases and page numbers are in fact a kind of table of contents, and you can set them up as such.

    The idea is to create the text of the endnotes in text frames anchored at the reference. For ease of identification, mark the key phrase in the text as conditional text (shows in the preview, doesn’t print). Those frames must be partially on the page otherwise the TOC won’t pick them up, but those frames can be set not to print. All this (and more) can be set up in an object style. The key phrases are in those frames as well.

    Define the TOC style to place the page number before the entry, and when you generate the TOC you’re basically done. The formatting of the key phrases is handled by a nested style.

    One thing that needs to be handled by a script is the removal of identical page numbers in the TOC, but that’s very simple.

    Unfortunately I can’t attach the document here that shows the set-up. And I can’t manage to include a screenshot that shows what it looks like. If you send me an email at pkahrel@gmail.com I’ll send you the InDesign document.

    Peter

    in reply to: Question about Index #14391627
    Peter Kahrel
    Participant

    Yep, InDesign documents can have just one index. But there are various workarounds. The simplest is to mark up the second index by adding a prefix in the sort-order field such that items with that prefix are placed at the end. (In a Latin-script index you’d use the prefix ‘zzz-‘.) Technically you still have one index, but when you generate the index all the prefixed items are together at the end of the index. All you need to do is add a title.

    Another, more elaborate, way to do this is to create two topics, say, “Cyrillic 1” and “Cyrillic 2”, and add topics of either index as subtopics under the relevant main topic. When you generate the index, the level-1 topics (Cyrillic 1 and Cyrillic 2) are in effect the titles of the indexes, and the level-2 topics are in fact level-1 topics. It’s easy to style them correctly in the paragraph style definitions.

    in reply to: Bold GREP Style if Colon is Present Excluding URL #14389812
    Peter Kahrel
    Participant

    This one seems to work: ^.+(?<!https):

Viewing 7 posts - 46 through 60 (of 332 total)