在Windows 10中适合替代HTA

时间:2017-06-15 04:40:40

标签: windows-10 hta

我在办公室工作,使用类似于每日消息的办公室 - > http://www.jhouseconsulting.com/2007/12/28/creating-a-message-of-the-day-banner-using-a-hta-4

但是,由于我们正在升级到Windows 10并且它不支持HTA(忽略IE9兼容性),因此需要更换。

问题是可以做同样的事情,附带条件是:

  • 不在登录之前(因此不使用登录横幅)
  • 仅在登录窗口之后
  • 除非使用"同意此MSG"否则不应该近距离接触按钮
  • 文本会有所不同所以需要简单的方法来保持文本不受控制(html文件?)
  • 将由DC(登录脚本)
  • 分发

此应用程序用于确认合规性和安全信息传播。谢谢你的想法,

2 个答案:

答案 0 :(得分:0)

AFAIK Windows 10仍然可以运行HTA。如果你想强制IE9模式,你可以在头部贴一个元标记:

<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
</head>

答案 1 :(得分:0)

试试这个HTA吧: 仅在Windows 7(64位)

上测试
<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>