Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: How do I make a loader image similar to those shown at program opening?

$
0
0

This script shows how to open a ScriptUI dialog and populate it with an image.

http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xlib/PreviewWindow.jsx

 

It, however, has a 'Close' button required to close the window. If you want to automatically close the dialog

after a set period of time, you will need to change openFile to something like this:

 

var sleepMS = 3000;  // how long to sleep in milliseconds

 

PreviewWindow.openFile = function(file, w, h, parent, title) {
  var win = new Window('palette', title || "Preview: " + decodeURI(file.name));
  win.closeBtn = win.add('button', undefined, 'Close');

  win.preview = win.add('image', undefined);
  win.preview.icon = file;

  if (w && h) {
    win.preview.preferredSize = [w, h];
  }

  if (parent) {
    win.center(parent);
  }

  win.closeBtn.onClick = function() {
    this.parent.close(1);
  }

  win.show();

  $.sleep(sleepMS);

  win.close();
  delete win;
  $.gc();
};

 

// example usage

PreviewWindow.open("~/tmp/preview.jpg");

 

I haven't tried this code out but it looks pretty close.


Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>