4 Replies Latest reply on Apr 27, 2009 10:06 AM by Kasyan Servetsky

    ScriptUI

      var win = new Window("window",'My Title',[0,0,400,200],{independent:true});
      win.show()

      When I run this script in Photoshop CS4, appears window and immediatly closes and script is finish (Photoshop don't closes).
      What problem? How I can create window (don't 'dialog' or 'palette')?
      Help me please.

      P.S. Script:

      var win = new Window("dialog",'My Title',[0,0,400,200],{independent:true});
      win.show()

      work normal.
        • 1. Re: ScriptUI
          Level 1
          When you launch a script in PS, it executes, then the script engine dies.

          When you make a modal dialog, the modal stops all processing in the script engine while it's showing, and it works.

          For types "window" and "palette", that's not the case (modality). The script executes, puts up the window, then completes. When it completes, it destroys itself, and your windows close.

          You can try opening your window or palette via BridgeTalk.

          var bt = new BridgeTalk();
          bt.target = "photoshop";
          bt.message = "var w = new Window( 'palette', 'My Palette' ); w.add( 'statictext', undefined, 'This is a palette' ); w.center();.w.show();"
          bt.send();

          You can do that in PS (photoshop can send a bt message to itself). BridgeTalk uses a persistent engine to process BT messages, so that *should* work at keeping a palette open. I haven't tried it myself.

          Bob
          • 2. Re: ScriptUI
            Level 1
            >
            > You can do that in PS (photoshop can send a bt message to itself). BridgeTalk uses a persistent engine to process BT messages, so that *should* work at keeping a palette open. I haven't tried it myself.
            >

            Something else for me to put on my to-do list...

            -X
            • 3. Re: ScriptUI
              Level 1
              Thanks fo your answer! But, i have а problem:

              Your code:
              >
              var bt = new BridgeTalk();
              bt.target = "photoshop";
              bt.message = "var w = new Window( 'palette', 'My Palette' ); w.add( 'statictext', undefined, 'This is a palette' ); w.center();.w.show();"
              bt.send();
              >

              don't works. When I run it in PS CS4, nothing happens. ExtendScript Toolkit writes: "Execution finished. Result: false"

              In Object Model Viewer I don't find information about BridgeTalk class. Where I can read about BridgeTalk class properties and methods?
              • 4. Re: ScriptUI
                Kasyan Servetsky Level 5

                I did it – a floating palette in Photoshop . So yes, it works, thanks Bob for the tip. If anyone is interested, an example is here: http://kasyan.ho.com.ua/save_psd_png_delete.html

                 

                Kasyan