我有一个简单的 Windows JavaScript,它将每 30 分钟弹出一次提醒,持续 10 秒。如何使弹出窗口出现在所有其他窗口的顶部?
var wshShell = WScript.CreateObject("WScript.Shell");
while(1) {
var value = wshShell.Popup("Reminder text", 10, "Reminder", 0x1);
if (value == 2) { // Cancel button pressed
break;
}
WScript.sleep(30 * 60 * 1000); // Every 30 minutes
}
WScript.Echo("Exiting timer!");
最佳答案
得到 Clackwell’s Weblog 的答复
WScript.Shell.Popup 的 nType 参数有一个未记录的值,该值会导致生成的对话框/弹出窗口“停留在顶部”/在前台,这意味着它们无法被其他窗口或对话框隐藏:4096。
JScript example:
WScript.CreateObject(“WScript.Shell”).Popup(“Message”, 0, “Title”, 4096);
VBScript example:
WScript.CreateObject(“WScript.Shell”).Popup “Message”, 0, “Title”, 4096
也记录在MSDN中
关于javascript - Windows Scripting Host 弹出窗口 - 在其他窗口之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38723708/