/build/static/layout/Breadcrumb_cap_w.png

How to create a customised popup notification window using HTA

Sometimes when deploying software to massive migrations, alerting the users of these events are very paramount. So to keep them updated you can send out a notification prior to deploying your package.

A simple way of doing this is by creating an HTA file which handles HTML and scripting code and launches using Microsoft (R) HTML Application host (c:\windows\system32\mshta.exe)

You can design your fonts, background colours using css and html or you can add images also. In this example, I am using only text to display my notification. Since I am disabling the min/max/exit buttons on the window (this way the users are forced to view this popup) I will add some vb and javascript to power my HTA file.

You can start by designing your HTA by creating a new text file and renaming the extension from .txt to .hta

Next, copy my code shown below and start tweaking it to suit your needs. After the end of the code is a breakdown explanation of how the it works. Start testing with short timer seconds or else you will need to keep taskmanager open to kill the mshta process to close the window - remember, in this example I have disabled the exit button from the popup window!

[---BEGIN OF CODE---]

<html>
<head>
<hta:application
APPLICATIONNAME = "Program ALERT"
ID = "Program ALERT"
BORDERSTYLE = "Normal"
CAPTION = "No"
CONTEXTMENU = "No"
INNERBORDER = "No"
MAXIMIZEBUTTON = "No"
MINIMIZEBUTTON = "No"
NAVIGABLE = "No"
SCROLL = "No"
SCROLLFLAT = "No"
SELECTION = "No"
SHOWINTASKBAR = "No"
SINGLEINSTANCE = "Yes"
SYSMENU = "No"/> <STYLE>
html, body {
background color: #000

font-size: 90%;
line-height: 2.1em;
margin: 10;
padding: 0;
}
h1 {font-family: Arial;
color: #007cd1;
font-size: 3em;
text-transform: uppercase;
text-align: center;
}
h2 {font-family: Arial;
color: #fff;
font-size: 1.5em;
text-transform: uppercase;
text-align: left;
}
h3
{font-family: Arial;
color: #666;
font-size: 1em;
text-transform: uppercase;
text-align: center;
}
</STYLE> <script type='text/vbscript'> Sub Window_onload()
Me.ResizeTo 600,380
Me.MoveTo Screen.Width /2 - 300,Screen.Height / 2 - 300
Me.SetTimeout "Me.Close()",5000
End Sub
</script>
</head>
<body scroll="no">
<br>
<h1>PROGRAM UPDATE!</h1>
<h2>Your computer is about to install an important system update.<br>
Please save and close all applications.<br>
A system reboot might occur between 5 and 10 minutes.</h2> <h3>IT DEPT - [auto close in <span id="timer"></span>secs]</h3> <script type="text/javascript">
var count=5; // seconds var counter=setInterval(timer, 1000);
function timer()
{
count=count-1;
if (count <= 0)
{
clearInterval(counter);
return;
} document.getElementById("timer").innerHTML=count + " "; //
}
</script>
</body>
</html>

[---END OF CODE---]
Here is the breakdown of the code:

 This is the result output:

Now you can add this to your deployment tools and remember: Always test before you rollout!!! 
Have fun creating your own custom notification popups! 

Smile

 

Comments

  • Very cool, thanks for sharing! - drose23 10 years ago
  • Just awesome! THX A LOT! - tecrumors 10 years ago
  • Thanks for sharing - Sujit J 10 years ago
  • I made one with a scroll bar on top of the scree:

    <button class="btn" type="close" value="close" onClick="closeWin()" style="float: right;"><img src="close.png" alt=""/></button>
    <marquee scrollamount="7" scrolldelay="5">
    <h2>UPDATES FOR YOU - Your IBM Engineering Team is about to install an important system update. Please save and close all applications. A system reboot might occur between 5 and 10 minutes</h2>
    </marquee>

    <script type='text/vbscript'> Sub Window_onload()
    Me.ResizeTo 1200,100
    Me.MoveTo Screen.Width /3 - 400,Screen.Height / 3 - 400
    Me.SetTimeout "Me.Close()",20000
    End Sub
    </script>

    Looks very cool. Sadly I cant post a pic here but you can find it here: http://tinypic.com/r/xgh0n4/5 - tecrumors 10 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ