Works well on CS6.
You can draw, adjust adjustments layers and even invoke other scripts.
var cs6 = (parseInt(app.version)==13)
var time = 60;
var old_time;
var msg = new Window("palette", "Draw or do something while script is waiting");
msg.preferredSize.width = 200;
msg.txt = msg.add("statictext", undefined, "");
msg.txt.preferredSize.width = 220;
msg.txt.justify = "center";
msg.btn = msg.add("button", undefined, "Continue");
msg.btn.onClick = function() { msg.hide(); }
msg.show();
msg.frameLocation = [50, 100];
$.hiresTimer;
set_performance("stepByStep");
app.displayDialogs = DialogModes.ERROR;
try {
while (msg.visible && time > 0)
{
if (old_time != time.toFixed(0))
{
msg.txt.text = "You have: " + time.toFixed(0) + " sec";
old_time = time.toFixed(0);
}
if (cs6) app.bringToFront();
else app.refresh();
time -= ($.hiresTimer/1000000);
}
}
catch (e) { }
set_performance("accelerated");
msg.close();
alert("Script End")
function set_performance(mode)
{
try {
var r1 = new ActionReference();
r1.putProperty( charIDToTypeID( "Prpr" ), charIDToTypeID( "PbkO" ) );
r1.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
var d1 = new ActionDescriptor();
d1.putReference( charIDToTypeID( "null" ), r1 );
var d2 = new ActionDescriptor();
d2.putEnumerated( stringIDToTypeID( "performance" ), stringIDToTypeID( "performance" ), stringIDToTypeID( mode ) );
d1.putObject( charIDToTypeID( "T " ), charIDToTypeID( "PbkO" ), d2 );
executeAction( charIDToTypeID( "setd" ), d1, DialogModes.NO );
}
catch (e) { throw(e); }
}