Create html alert that stays on the top and block other windows with vbscrips [closed]

ぃ、小莉子 提交于 2020-08-19 05:49:18

问题


There is a html file including alert message. And I want to load the html file at vbs file through internetExplorer. How can I make the alert stay on the top and block other windows using vbscript? But I can’t handle the html file. Can I control the alert in html with vbscript even if internetExplorer’s visible is false in vbscript?

Vbs file ↓


Option Explicit

Dim ie
Dim window
Dim document
Dim url

url    = "C:/tmp/screenTest.html"

Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.navigate("about:blank")

Set document = ie.Document
Set window   = document.parentWindow

With ie
    .Top     = (window.screen.availHeight - ie.Height + 50) / 2
    .Visible = False
End With

ie.navigate url

Set ie = Nothing
Set window = Nothing
Set document = Nothing

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body onload="alertTest();">
    <script>
        function alertTest(){
            alert("test");
        }
    </script>
</body>
</html>

来源:https://stackoverflow.com/questions/63386128/create-html-alert-that-stays-on-the-top-and-block-other-windows-with-vbscrips

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!