Indesign Script JS:编辑文档 TextFrame 内容并返回对话框窗口 [英] Indesign Script JS: Edit Document TextFrame Content and get back to Dialog Window

查看:22
本文介绍了Indesign Script JS:编辑文档 TextFrame 内容并返回对话框窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 JS 编辑 Indesign 文档中的一些文本框内容.但是我找不到任何解决方案来通过对话框窗口中的反馈获得任何更改.所以我只有一个简单的文档,其中包含一个名为 test

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

我只是粘贴相关部分以保持简单,在我的对话框中我有很多设置...

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
    }

在显示对话框时您无法进行任何更改.但是我如何让 Dialog 回来?

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

推荐答案

为了保持您的自定义窗口和 UI 访问权限,将此窗口定义为调色板"而不是对话框".您的脚本第一个指令也应该调用您的自定义目标引擎,例如:#targetengine "mysession"

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"

这篇关于Indesign Script JS:编辑文档 TextFrame 内容并返回对话框窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆