Web

HTA script to display computer name with compare operations

Posted on

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";             }         } […]

Advertisements
Web

HTA script to display computer name

Posted on

  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">     function computername()     {         var wshShell = new ActiveXObject("WScript.Shell")         var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")         return sComputerName     } </script> <strong>Computer Name is: <script type="text/javascript"> document.write(computername());</script></strong> </body> </html>     Output: