Hey guys,
Is there a way to have a palette window display for a certain duration while the script continues to run in the background? Basically, I want a form of alert window that doesn't pause the script while it's up. It doesn't have to be a palette window, but that's the only thing I can think of that would work for this. If you have any ideas for other kinds of windows that could do this, I'd be open to that as well. It just basically needs to be a window that will come up and tell the user that no errors were found in their naming and it is now saving their work, staying up long enough to read, then closing itself. Thanks in advance for any help!
dgolberg
Sounds like perhaps you want a progress bar http://forums.adobe.com/message/4530678#4530678http://forums.adobe.com/message/4530678#4530678
Yeah, it's the same script that progress bar is already in. I actually have included a check script before that progress bar comes up that checks to confirm that the app is setup correctly. If it's not setup correctly, it alerts them and terminates the script. If it is setup correctly, I'd like to have a window that comes up and confirms that it's correct and/or tells them of any common errors that it fixed automatically but does not pause the script like an alert window does.
Basically, I just need a window that can display for a set period of time before closing while the rest of the script continues to work in the background. Is there any way to put a display time on a palette window? Something along the lines of:
var w = new Window('palette','Check Complete');
w.show().displayTime(4000); //Time in milliseconds
I'm sure that's not correct, but you get the idea.
I don’t know if there’s a proper way to do this, but one can getTime() before showing the window, then set up a while function to compare the current time with that and close the window if a certain difference has been reached.
But that would effectively halt the Script for the duration and seems a somewhat brute approach.
Edit: Instead of a while function I guess one could also check for the passed time at later positions in the Script, but who knows if that’s a good idea?
Edit 2: It seems to work, though; Photoshop can execute (at least some) Script commands while the window is open.
Well, like I said in an edit to the message it seems to work.
Not sure if it’s wise to do it thusly, though.
// 2012, use it at your own risk;
#target photoshop
var w = new Window('palette','Check Complete', [500,300,820,850]);
var now = new Date();
var thisTime = now.getTime();
var ret = w.show();
var myDocument = app.documents.add(new UnitValue(2000, "px"), new UnitValue(2000, "px"), 300, "test", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
myDocument.selection.selectAll();
checkTime (thisTime);
myDocument.selection.fill(app.foregroundColor, ColorBlendMode.NORMAL, 100, false);
checkTime (thisTime);
myDocument.layers[0].applyClouds();
checkTime (thisTime);
myDocument.selection.deselect();
checkTime (thisTime);
check = true;
while (check == true) {
var now2 = new Date();
var thisTime2 = now2.getTime();
if (thisTime2 > thisTime + 1000) {
check = false;
try {w.close()} catch (e) {}
}
};
////////////////////////////////////
function checkTime (thisTime) {
var now2 = new Date();
var thisTime2 = now2.getTime();
if (thisTime2 > thisTime + 1000) {w.close()}
};
Hmm, not quite what I was looking for, but it might work. I suppose I could run a few test runs on it to see how long it takes to get to certain points and have it check time passed. I do have a few things that loop I could try it in. I'll give it a shot and see how it goes. Thanks again for the ideas!
Maybe you should wait for more feedback … because this approach seems a bit strange.
Have you also asked over at http://ps-scripts.com/bb/ ?
North America
Europe, Middle East and Africa
Asia Pacific