HTA script to display computer name with compare operations

Code:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <HTA:APPLICATION ID="A1" ICON="" APPLICATIONNAME="Test-HTA" sysMenu="no" navigable="yes" scroll="no" border="none" showintaskbar="yes" singleinstance="yes" innerborder="no">
    <title>Test-HTA</title>
</head>

<body>
    <script type="text/javascript">
        window.resizeTo((screen.width), (screen.height – 20))
        self.moveTo(0,0)
    </script>
   
    <script type="text/javascript">
        function computername()
        {
            var wshShell = new ActiveXObject("WScript.Shell")
            var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
            if(sComputerName.toLowerCase() == "govardhan-pc".toLowerCase())
            {
                return "You are logged on to " + sComputerName + " system";
            }
            else
            {
                return "You are logged on to a different system";
            }

        }
    </script>
   
    <strong>
        <script type="text/javascript"> document.write(computername());</script>
    </strong>
</body>
</html>

 

image

Leave a Reply

Your email address will not be published. Required fields are marked *