Windows 10 Windows 10中HTA的合适替代品
我在一个办公室工作,这里使用类似于每日信息的东西-> 但由于我们正在升级到Windows10,而且它不支持HTA(忽略IE9兼容性),因此需要更换它 问题是什么可以做同样的事情,但书是:Windows 10 Windows 10中HTA的合适替代品,windows-10,hta,Windows 10,Hta,我在一个办公室工作,这里使用类似于每日信息的东西-> 但由于我们正在升级到Windows10,而且它不支持HTA(忽略IE9兼容性),因此需要更换它 问题是什么可以做同样的事情,但书是: 登录前不可用(因此不使用登录横幅) 仅在登录窗口之后 除非使用“同意此消息”按钮,否则不应关闭 文本会有所不同,所以需要简单的方法来控制文本(html文件?) 将由DC分发(登录脚本) 此应用程序用于确认合规性和安全信息传播。感谢您的想法,AFAIK Windows 10仍然可以运行HTA。如果您想强制IE
- 登录前不可用(因此不使用登录横幅)
- 仅在登录窗口之后
- 除非使用“同意此消息”按钮,否则不应关闭
- 文本会有所不同,所以需要简单的方法来控制文本(html文件?)
- 将由DC分发(登录脚本)
此应用程序用于确认合规性和安全信息传播。感谢您的想法,AFAIK Windows 10仍然可以运行HTA。如果您想强制IE9模式,可以在头部粘贴一个元标记:
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
</head>
试试这个HTA: 仅在Windows 7上测试(64位)
今日讯息
身体{
字体:13pt arial;
颜色:白色;
过滤器:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#000000',EndColorStr='#0000FF')
}
p{
保证金:0;
}
选项显式
常数ForReading=1
子窗口加载
Dim STROMTDFILE、ARR命令、strLogonServer、strCommonPath、strPath、STRCRENTPATH、strLine、strContents
Dim i,WshShell,oFSO,objFile
strMOTDFile=“motd.txt”
arrcomands=Split(objHTAInfo.commandLine,chr(34))
'取消注释后三行仅用于测试。
'对于i=3到(Ubound(arrCommands)-1)步骤2
'Msgbox命令(i)
”“接着呢
如果Ubound(arrCommands)=2,则
strcurrentPath=Replace(左侧(document.location.pathname),InStrRev(document.location.pathname,“\”),%20“,”)
strPath=strcurrentPath
其他的
设置WshShell=CreateObject(“WScript.Shell”)
strLogonServer=WshShell.ExpandEnvironmentStrings(“%LogonServer%”)
strPath=strLogonServer&“\”&arrCommands(3)&“\”
如果结束
'取消注释下一行仅用于测试。
'Msgbox strPath
Set of so=CreateObject(“Scripting.Filesystemobject”)
如果存在of so.files(strPath和strMOTDFile),则
设置objFile=oFSO.OpenTextFile(strPath&strMOTDFile,ForReading)
直到objFile.AtEndOfStream
strLine=objFile.ReadLine
strContents=strContents&strLine&“
”
环
objFile.Close
document.getelementbyid(“textarea”).innerHTML=strContents
其他的
出口程序
如果结束
posBtn
document.body.onresize=GetRef(“posBtn”)
设置WshShell=Nothing
一组SO=零
设置objFile=Nothing
端接头
子posBtn
尺寸btn、bod、leftLoc
Set btn=document.getelementbyid(“运行按钮”)
Set bod=document.getelementbyid(“主体”)
leftLoc=(bod.offsetWidth/2)-(btn.offsetWidth/2)
btn.style.position=“绝对”
btn.style.posLeft=leftLoc
端接头
子出口程序
window.close()
端接头
今日讯息
重要提示:
抱歉,无法使用IE9兼容性,必须有完全替换方法抱歉,无法使用IE9兼容性,必须有完全替换方法您仍然可以在Win10和IE11中运行HTAs。你唯一会错过的是HTA标签中定义的属性,即没有窗口外观控件、没有单个实例、没有图标、没有选择控件等。如果你没有这些属性,其他一切都可以正常工作+你可以通过对HTML5和“IE=edge”的X-UA使用DTD来应用比早期版本更现代的JS和DOM。除了窗口控件外,您还可以攻击大多数其他属性,因为HTA的所有权限仍在使用中。
<html>
<!--
MOTD.hta (Message of the Day)
Written by Jeremy.Saunders@au1.ibm.com on 12/11/06.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Message of the Day</title>
<hta:application id="objHTAInfo"
applicationname="Message of the Day"
version="1.0"
border="thin"
borderstyle="raised"
caption="yes"
contextmenu="yes"
innerborder="no"
maximizebutton="no"
minimizebutton="no"
selection="yes"
scroll="yes"
scrollflat="yes"
showintaskbar="no"
SysMenu="no"
SINGLEINSTANCE="yes"
>
<style type="text/css">
body {
font: 13pt arial;
color: white;
filter: progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')
}
p {
margin: 0 0 0 0;
}
</style>
</head>
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Const ForReading = 1
Sub Window_Onload
Dim strMOTDFile, arrCommands, strLogonServer, strCommonPath, strPath, strcurrentPath, strLine, strContents
Dim i, WshShell, oFSO, objFile
strMOTDFile = "motd.txt"
arrCommands = Split(objHTAInfo.commandLine, chr(34))
' Uncomment the next three lines for testing only.
' For i = 3 to (Ubound(arrCommands) - 1) Step 2
' Msgbox arrCommands(i)
' Next
If Ubound(arrCommands) = 2 Then
strcurrentPath = Replace(Left(document.location.pathname,InStrRev(document.location.pathname,"\")),"%20"," ")
strPath = strcurrentPath
Else
Set WshShell = CreateObject("WScript.Shell")
strLogonServer = WshShell.ExpandEnvironmentStrings("%LogonServer%")
strPath = strLogonServer & "\" & arrCommands(3) & "\"
End If
' Uncomment the next line for testing only.
' Msgbox strPath
Set oFSO = CreateObject("Scripting.Filesystemobject")
If oFSO.fileexists(strPath & strMOTDFile) Then
Set objFile = oFSO.OpenTextFile(strPath & strMOTDFile, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strContents = strContents & strLine & "<BR>"
Loop
objFile.Close
document.getelementbyid("textarea").innerHTML = strContents
Else
ExitProgram
End If
posBtn
document.body.onresize = GetRef("posBtn")
Set WshShell = Nothing
Set oFSO = Nothing
Set objFile = Nothing
End Sub
Sub posBtn
Dim btn, bod, leftLoc
Set btn=document.getelementbyid("runbutton")
Set bod=document.getelementbyid("mainbody")
leftLoc = (bod.offsetWidth/2) - (btn.offsetWidth/2)
btn.style.position="absolute"
btn.style.posLeft = leftLoc
End Sub
Sub ExitProgram
window.close()
End Sub
</SCRIPT>
<body id="mainbody">
<center><h1>Message of the Day</h1></center>
<h3>Important notice:</h3>
<p id="textarea"></p>
<BR>
<BR>
<input id=runbutton type="button" value="I have read and understood this message." onClick="ExitProgram">
</body>
</html>