dm-script

Any better way to show the text information than NewScriptWindow command


I'd like to show tens of lines of text information. The output window is not a good idea since it can only show ~10 lines. Now I open a script window by using NewScriptWindow command, and then add text into the window by using EditorWindowAddText command. It works pretty well. But the problem is when I close it, it will ask me whether to save the file. Since it's just temporary display, I'd like close it directly, instead of seeing the annoying prompt. Hope there is some solution. Other solutions than NewScriptWindow are also welcome.

DocumentWindow text_win
text_win = NewScriptWindow("Mag Table", 100, 100, 800, 900)
text_win.EditorWindowAddText("Mag 1000x" + "\n")
text_win.EditorWindowAddText("Mag 2000x" + "\n")

Solution

  • Why can the output window only show ten lines? It can show as many as fit in the window, which you can resize... But using the EditorWindow is of course also fine.

    You can close it (without prompt) from script:

    documentwindow myWin = NewScriptWindow("My Text",100,100,600,800)
    myWin.EditorWindowAddText("My text")
    
    sleep(1)
    myWin.WindowClose(0)
    

    Alternatively, you can ensure to mark any "changed" window text as "clean", i.e. as "does not need to be saved" using

    documentwindow myWin = NewScriptWindow("My Text",100,100,600,800)
    myWin.EditorWindowAddText("My text")
    
    myWin.WindowClean()
    

    Now closing it with X will not ask for saving. But you need to do this, whenever the window context is changed.