Skip to main content
Participant
January 13, 2009
Question

ScriptUI

  • January 13, 2009
  • 2 replies
  • 2024 views
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.
This topic has been closed for replies.

2 replies

_Bordac_Author
Participant
January 14, 2009
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?
Kasyan Servetsky
Legend
April 27, 2009

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

January 13, 2009
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
Known Participant
January 13, 2009
>
> 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