Indesign Script JS: Edit Document TextFrame Content and get back to Dialog Window

馋奶兔 提交于 2021-01-29 08:31:17

问题


I want to edit some textframe content in Indesign documents by JS. But I cannot find any solution to get any change with feedback in Dialog Window. So I just have a simple document with one Textframe with name test

I just paste relevant parts to keep it simple, in my Dialog I have lot of settings...

var w = new Window ("dialog","DialogTitle");  
    var changeText = w.add("button", [0,0,150,20], "change test Text");  
    changeText.onClick = function(){ 
        w.close(1);
    } 

    var result = w.show(); 

    if (result == 1){
        myFrame = app.activeDocument.textFrames.itemByName("test");
        myFrame.contents = "New Text";
        var result = w.show(0);    //Here I want to reopen the Window w
        //Is not working
    }

you could not make any changes while Dialog is shown. But how I get Dialog back?


回答1:


To keep your custom window and UI access define this window as "palette" instead of "dialog". Your script 1st directive supposes to call your custom targetengine as well, something like: #targetengine "mysession"



来源:https://stackoverflow.com/questions/33660013/indesign-script-js-edit-document-textframe-content-and-get-back-to-dialog-windo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!