Back

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

Forum Replies Created

Viewing 4 posts - 31 through 45 (of 329 total)
  • Author
    Posts
  • in reply to: Ranged left text not lining up #14396363
    Peter Kahrel
    Participant

    I was never aware of Dave’s script. It’s a very clever solution, but for me the sidebearing showing up at the start of a line is a kerning problem, and my kerning script deals with it:

    https://creativepro.com/files/kahrel/indesign/kern.html

    Peter Kahrel
    Participant

    Bad sport!

    Peter Kahrel
    Participant

    Did you check whether there are any paragraphs that end in a space (or more spaces even)? If there are any they would trip up the solutions suggested above. To delete any trailing spaces, use this query:

    Find: +$
    Replace with: <leave empty>

    And for sport here’s yet another query to find paragraphs that don’t end in a period and insert a period:

    Find: (?<!\.)$
    Replace with: .

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

    Ah — sorry. The script was meant to search whole-word-only, but I made a mistake in that line. Below is the corrected version. It also first removes any highlighting so that you can run the script again against a document with a risk list with some words removed: the highlights on those words is then removed.

    
    (function () {
      var condition;
      var riskWords;
    
      // Remove and recreate the condition if it exists
      // so that words removed from the list are
      // 'unrisked' in the text
    
      function getCondition () {
    
        var c = app.documents[0].conditions.item('Risk word');
        
        if (c.isValid) {
          var p = c.properties;
          // This is quicker than removing the highlights in the text
          c.remove();
          c = app.documents[0].conditions.add(p);
        } else {
          app.documents[0].conditionalTextPreferences.showConditionIndicators = 
            ConditionIndicatorMode.SHOW_INDICATORS;
          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.findChangeTextOptions.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]);
      }
    
    }());
    
Viewing 4 posts - 31 through 45 (of 329 total)