Constructing a proxy in a JSX Dialog window

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

jcr6

Constructing a proxy in a JSX Dialog window

Post by jcr6 »

Up to this point, I've been rather successful in putting PNG graphics into my dialogs. Obviously the button graphics that I've been using reside on disk, but it seems obvious that I could change the underlying graphic on disk... hopefully to update the dialog that I've got up on the screen.

So, let's say that I've got a plugin that generates a histogram of the current image (say a 32-bit image to make it interesting). How can I FORCE ExtendScript to redraw (and thus RELOAD) my .PNG graphic from disk in response to some other slider or function in my dialog changing?

Basically I'd like to use my Javascript dialog AS my cross-platform UI and use images (or proxies) stored on disk to generate previews.

The next problem will be detecting clicks and drags in a preview, but that one may not be in the cards, but for the purposes of histograms and the like, I'd sure like to be able to have a more dynamic display in my window. Without having to use Flash.
Patrick

Constructing a proxy in a JSX Dialog window

Post by Patrick »

This worked for me:

Code: Select allvar win = new Window("dialog{text:'redraw image test',bounds:[100,100,410,270],\
      image0:Image{bounds:[10,10,300,130] , icon:'/c/sandbox/test2.png'},\
      button0:Button{bounds:[10,140,110,160] , text:'redraw' }\
};");


win.button0.onClick = function() {
   win.image0.icon = '/c/sandbox/blank.png';
   win.image0.icon = '/c/sandbox/test2.png';
}

win.center();
win.show();


Switch the image to something else then back to the original image, it will reflect any change to the image on disk after the dialog was opened.

This is not a true "preview", I can't image there is any way you could detect clicks/drags on the image - you are stuck with the normal dialog control objects.

Patrick
jcr6

Constructing a proxy in a JSX Dialog window

Post by jcr6 »

But I could at least write out a histogram, and do my toggle switch to a "calculating" type image. Hmmm.

What other formats besides .PNG work in these dialogs, I wonder?
Patrick

Constructing a proxy in a JSX Dialog window

Post by Patrick »

AFAIK, you can only use PNG in dialogs. Also, when I was testing it there was usually no delay in updated the images - a couple times you could see it flicker real quick. Having a "calculating" image would probly be excessive as it would just blink back to your histogram.

Patrick