0

in order to make my work with InDesign easier, I've generated this Find/Change script using chainGREP. This is part of code only:

// Query [[Query GREP1]] -- If you delete this comment you break the update function
        try {
            app.findChangeGrepOptions.properties = ({includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, kanaSensitive:true, widthSensitive:true});
            app.findGrepPreferences.properties = ({justification:1667591796, appliedFont:"Open Sans", fontStyle:"Bold", pointSize:10});
            app.changeGrepPreferences.properties = ({paragraphDirection:1379028068, characterDirection:1147496036, digitsType:1684627826, kashidas:1801544805, justification:1667591796, composer:"Adobe World-Ready Paragraph Composer", appliedFont:"Adobe Arabic", fontStyle:"Bold", pointSize:15, leading:15, appliedLanguage:"Arabic"});
            changeObject.changeGrep();
        } catch (e) {alert(e + ' at line ' + e.line)}
        app.findGrepPreferences = NothingEnum.NOTHING;
        app.changeGrepPreferences = NothingEnum.NOTHING;
        // Query [[Query GREP2]] -- If you delete this comment you break the update function
        try {
            app.findChangeGrepOptions.properties = ({includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, kanaSensitive:true, widthSensitive:true});
            app.findGrepPreferences.properties = ({justification:1667591796, appliedFont:"Open Sans", pointSize:8});
            app.changeGrepPreferences.properties = ({paragraphDirection:1379028068, digitsType:1684627826, justification:1667591796, composer:"Adobe World-Ready Paragraph Composer", appliedFont:"Adobe Arabic", pointSize:11, leading:11, appliedLanguage:"Arabic"});
            changeObject.changeGrep();
        } catch (e) {alert(e + ' at line ' + e.line)}
        app.findGrepPreferences = NothingEnum.NOTHING;
        app.changeGrepPreferences = NothingEnum.NOTHING;
        // Query [[Query GREP3]] -- If you delete this comment you break the update function
        try {
            app.findChangeGrepOptions.properties = ({includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, kanaSensitive:true, widthSensitive:true});
            app.findGrepPreferences.properties = ({justification:1667591796, appliedFont:"Open Sans", pointSize:11});
            app.changeGrepPreferences.properties = ({paragraphDirection:1379028068, characterDirection:1147496036, digitsType:1684627826, kashidas:1801544805, justification:1667591796, composer:"Adobe World-Ready Paragraph Composer", appliedFont:"Adobe Arabic", pointSize:15, leading:15, appliedLanguage:"Arabic"});
            changeObject.changeGrep();
        } catch (e) {alert(e + ' at line ' + e.line)}

Got only one question. Is it possible to put pointSize in range, eg.

pointSize>=10 && pointSize<=10.5

Or maybe there is easier way to automate Find/Change?

sp33dy
  • 3
  • 3
  • Also asked in [https://community.adobe.com/t5/indesign/adobe-indesign-find-change-script/td-p/11071377?page=1]. Please ask a question only in one site at a time to prevent double answers, more people working for nothing, and scattered solutions. (The answer over there is "Not supported by Find/Change".) – Jongware Apr 23 '20 at 09:06
  • Sure, I'll remember. Sorry. – sp33dy Apr 23 '20 at 12:33

1 Answers1

0

After getting the result from find/change, you may use javascript to do the pointSize checking.

app.findGrepPreferences.findWhat = '.+';
app.changeGrepPreferences.changeTo = 'changed';

var results = app.findGrep();

for (var i=0; i<results.length; i++){
    if (results[i].pointSize>=10 && results[i].pointSize<=10.5){
        results[i].changeGrep();
        }
    }
jeremyf
  • 18
  • 2