窗口打开正常,但在手动关闭弹出窗口之前脚本不会继续!这是不可取的,因为我宁愿窗口在 n
几秒钟后自行关闭......
那么我是否必须在脚本其余部分的单独线程中打开窗口?这甚至可能吗?
到目前为止,这是我的代码:
function showMessageWindow()
{
var script = getScriptName(); // initialized from the function below
var message = new Window("dialog", script);
message.add("StaticText", undefined, "The script " + script + " is now running, please wait...");
message.show();
var startTime = new Date().getTime(); // in milliseconds
var currentTime = new Date().getTime(); // in milliseconds
var waitTime = 5000; // 1000 milliseconds is 1 second
var delay = function()
{
while( (currentTime - startTime) < waitTime)
{
currentTime = new Date().getTime(); // in milliseconds
}
} // end of closure delay
delay(); // calling the delay closure function here
message.close(); // close the message after the specified delay time
} // end of function showMessageWindow
// called from the function showMessageWindow
function getScriptName()
{
var scriptName = "";
try
{
scriptName = File(app.activeScript).name;
}
catch(e)
{
scriptName = File(e.fileName).name;
}
return scriptName;
} // end of function getScriptName