首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Adobe InDesign查找/更改脚本

Adobe InDesign查找/更改脚本
EN

Stack Overflow用户
提问于 2020-04-23 03:47:09
回答 1查看 279关注 0票数 0

为了使我更容易使用InDesign,我使用chainGREP生成了这个查找/更改脚本。这只是代码的一部分:

代码语言:javascript
复制
// 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放在范围内,例如。

代码语言:javascript
复制
pointSize>=10 && pointSize<=10.5

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

EN

回答 1

Stack Overflow用户

发布于 2021-02-13 00:26:38

在获得find/change的结果后,您可以使用javascript进行pointSize检查。

代码语言:javascript
复制
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();
        }
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61373856

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档