0

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?

user3339163
  • 23
  • 1
  • 3
  • A dialog is shown but it's empty (no element no title) and not my expected w Dialog – user3339163 Nov 11 '15 at 21:25
  • It does not say in the reference, but may be it is the window object being destroyed when on close method. I would try to run exactly the same window creation code again. – Nicolai Kant Nov 12 '15 at 14:31
  • Hello Nicolai Kant, thank you for comment. I tryed to do this with a Function and its working, but I don't think it's a good solution. – user3339163 Nov 12 '15 at 16:14
  • Well, working solution is a good solution. I tried to trace it and window is not destroyed, object still exists after close. I think there is a second window off screen, which locks my inDesign after the script is run. – Nicolai Kant Nov 12 '15 at 17:18

1 Answers1

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"

Julien Grégoire
  • 16,864
  • 4
  • 32
  • 57
Cashmirek
  • 269
  • 1
  • 9