2017-06-15 57 views
1

我在辦公室工作,使用類似的東西來消息日在這裏 - >http://www.jhouseconsulting.com/2007/12/28/creating-a-message-of-the-day-banner-using-a-hta-4合適的替代10

但是,當我們要升級到Windows 10,它不支持HTA (忽略IE9兼容性),這將需要更換。

問題是什麼可以做同樣的事情,但條件是:

  • 之前沒有登錄(所以不使用登錄提示)
  • 只有在登錄窗口
  • 不應該是除了近距離能通過使用「同意這個MSG」按鈕
  • 文本將不同,所以需要簡單的方法來保持從控制文本(HTML文件?)
  • 將DC(登錄腳本)分佈

此應用程序用於合規性和安全信息傳播的確認。感謝您的想法,

+0

你可以仍然在Win10和IE11中運行HTA。唯一會遺漏的是在HTA標籤中定義的屬性,即沒有窗口外觀控制,沒有單個實例,沒有圖標,沒有選擇控制等。如果你的生活沒有這些屬性,其他一切都可以正常工作+你可以申請更多現代的JS和DOM與早期版本相比,通過使用DTD的HTML5和X-UA的「IE = edge」。除了窗口控制,您還可以破解大部分其他屬性,因爲所有HTA的權限仍在使用中。 – Teemu

回答

0

AFAIK Windows 10仍然可以運行HTA。如果要強制IE9模式下,你可以在頭貼meta標籤:

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

抱歉無法使用IE9兼容性,必須有完整的替換方法 – Sean

0

只要給這個HTA一試: 僅在Windows 7測試(64位)

<html> 
<!-- 
    MOTD.hta (Message of the Day) 
    Written by [email protected] 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> 
+0

抱歉無法使用IE9兼容性,必須有完整的替換方法 – Sean