HTA 同时打开一个程序和一个模态
HTA open a program and a modal same time
尝试从 PC 打开程序,使用 HTA 应用程序,同时模式 window 打开通知用户程序正在加载,请稍候。
问题是Modal只在我关闭启动的程序后才显示?
尝试搜索 google 和 Whosebug 但没有成功
我以前没有使用 java、HTA 等的经验。所以我用我能找到的任何代码和大量的试验和错误来构建它
打开模式并在一段时间后再次关闭它的脚本。(小问题是它只能使用自动关闭功能一次,然后页面需要重新加载才能再次工作..容易修复吗? )
$(document).ready(function(){
$("#myBtn").click(function(){
$('#myModal').modal({backdrop: 'static', keyboard: false})
});
setTimeout(function() {
$('#myModal').modal('hide');
}, 5000);
});
使我能够打开程序的脚本:
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (which,1,true);
}
这就是我 link 打开程序和模式的方式:
<a
href="javascript:window.location.href=window.location.href"
id="myBtn"
onclick="runApp('file://C:/Windows/System32/notepad.exe');parent.playSound('assets/sounds/start.mp3');return false;"
onmouseover="playSound('assets/sounds/hover.wav');"
unselectable="on"
style="cursor: hand; display: block;">Link text
</a>
这是模态 window:
<!-- START: Modal -->
<div id="myModal" class="modal nk-modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title nk-title" id="myModalLabel">Starter program</h4>
</div>
<div class="modal-body">
<h4>Please wait</h4>
<p>Some text goes here.</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- END: Modal -->
所以当我单击 link 打开程序时(notepad.exe)然后程序打开没有问题,但是模态不显示..当我关闭记事本时模态 windows 打开,然后在一段时间后关闭。
我希望在单击 link 时显示模式。因此用户知道计算机正在加载程序并防止多次点击 link.
有人知道我该如何解决这个问题吗?
很难同步,但一种选择是不等到应用程序结束(第 3 个参数为 false)并在 .运行:
旁边放置警报
<script>
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (which,1,false);
alert(which.substr(which.lastIndexOf('/')+1) + " started\nplease wait");
}
</script>
<a href="#" onclick="javascript:runApp('file://C:/Windows/System32/notepad.exe')">Notepad</a>
或者像这样:
<script>
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
var linksEl = document.getElementById("links");
var modEl = document.getElementById("modal");
modEl.innerText = which.substr(which.lastIndexOf('/')+1) + " executed\nWaiting on its exit..."
linksEl.style.display = "none";
WshShell.Run (which,1,true);
modEl.innerText = "";
linksEl.style.display = "";
}
</script>
<body>
<span id="links">
<a href="#" onclick="runApp('file://C:/Windows/System32/notepad.exe')">Notepad</a>
</span>
<span id="modal"></span>
</body>
和第二个变体的演示片段(即使 window.open 也不起作用,被警报取代):
function runApp(which) {
var linksEl = document.getElementById("links");
var modEl = document.getElementById("modal");
modEl.innerText = which.substr(which.lastIndexOf('/')+1) + " executed\nWaiting on its exit..."
linksEl.style.display = "none";
alert(which);
modEl.innerText = "";
linksEl.style.display = "";
}
<span id="links">
<a href="#" onclick="runApp('http://www.google.com')">Notepad</a>
</span>
<span id="modal"></span>
尝试从 PC 打开程序,使用 HTA 应用程序,同时模式 window 打开通知用户程序正在加载,请稍候。
问题是Modal只在我关闭启动的程序后才显示?
尝试搜索 google 和 Whosebug 但没有成功
我以前没有使用 java、HTA 等的经验。所以我用我能找到的任何代码和大量的试验和错误来构建它
打开模式并在一段时间后再次关闭它的脚本。(小问题是它只能使用自动关闭功能一次,然后页面需要重新加载才能再次工作..容易修复吗? )
$(document).ready(function(){
$("#myBtn").click(function(){
$('#myModal').modal({backdrop: 'static', keyboard: false})
});
setTimeout(function() {
$('#myModal').modal('hide');
}, 5000);
});
使我能够打开程序的脚本:
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (which,1,true);
}
这就是我 link 打开程序和模式的方式:
<a
href="javascript:window.location.href=window.location.href"
id="myBtn"
onclick="runApp('file://C:/Windows/System32/notepad.exe');parent.playSound('assets/sounds/start.mp3');return false;"
onmouseover="playSound('assets/sounds/hover.wav');"
unselectable="on"
style="cursor: hand; display: block;">Link text
</a>
这是模态 window:
<!-- START: Modal -->
<div id="myModal" class="modal nk-modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title nk-title" id="myModalLabel">Starter program</h4>
</div>
<div class="modal-body">
<h4>Please wait</h4>
<p>Some text goes here.</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- END: Modal -->
所以当我单击 link 打开程序时(notepad.exe)然后程序打开没有问题,但是模态不显示..当我关闭记事本时模态 windows 打开,然后在一段时间后关闭。
我希望在单击 link 时显示模式。因此用户知道计算机正在加载程序并防止多次点击 link.
有人知道我该如何解决这个问题吗?
很难同步,但一种选择是不等到应用程序结束(第 3 个参数为 false)并在 .运行:
旁边放置警报<script>
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (which,1,false);
alert(which.substr(which.lastIndexOf('/')+1) + " started\nplease wait");
}
</script>
<a href="#" onclick="javascript:runApp('file://C:/Windows/System32/notepad.exe')">Notepad</a>
或者像这样:
<script>
function runApp(which) {
WshShell = new ActiveXObject("WScript.Shell");
var linksEl = document.getElementById("links");
var modEl = document.getElementById("modal");
modEl.innerText = which.substr(which.lastIndexOf('/')+1) + " executed\nWaiting on its exit..."
linksEl.style.display = "none";
WshShell.Run (which,1,true);
modEl.innerText = "";
linksEl.style.display = "";
}
</script>
<body>
<span id="links">
<a href="#" onclick="runApp('file://C:/Windows/System32/notepad.exe')">Notepad</a>
</span>
<span id="modal"></span>
</body>
和第二个变体的演示片段(即使 window.open 也不起作用,被警报取代):
function runApp(which) {
var linksEl = document.getElementById("links");
var modEl = document.getElementById("modal");
modEl.innerText = which.substr(which.lastIndexOf('/')+1) + " executed\nWaiting on its exit..."
linksEl.style.display = "none";
alert(which);
modEl.innerText = "";
linksEl.style.display = "";
}
<span id="links">
<a href="#" onclick="runApp('http://www.google.com')">Notepad</a>
</span>
<span id="modal"></span>