0

为了使我的 InDesign 工作更轻松,我使用 chainGREP 生成了这个 Find/Change 脚本。这只是代码的一部分:

// 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)}

只有一个问题。是否可以将 pointSize 放在范围内,例如。

pointSize>=10 && pointSize<=10.5

或者也许有更简单的方法来自动化查找/更改?

4

1 回答 1

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();
        }
    }
于 2021-02-12T16:26:37.790 回答