Answer» Okay I know pretty MUCH zero about vbs just to give you some background. I found this code on another forum and it does pretty much exactly what I need except for it echos the hostname of a pc in a pop-up box. I need it to write a line (this is going inside an HTA file). Here's the code:
Code: [Select] Option EXPLICIT
Dim WSHShell Dim objNTInfo Dim GetComputerName
Set objNTInfo = CreateObject("WinNTSystemInfo") GetComputerName = lcase(objNTInfo.ComputerName)
Set WSHShell = WScript.CreateObject("WScript.Shell") WSHShell.Popup(GetComputerName) WScript.Quit
Just reading AROUND online a bit I'm guessing I need to use ".write" somewhere or other but I can't quite figure it out. HTA's are a COMBINATION of HTML code and script code that runs under an interpreter (mshta.exe) and needs no browser.
I changed your code a bit, wrapped it in a HTML SKELETON, and it's about as ugly as you can get; but it does what you requested in your post.
Code: [Select]<html> <!-- --> <head> <title>HTA Test</title> <HTA:APPLICATION ID = "HTA Test" APPLICATIONNAME = "Application Name" > </head>
<SCRIPT LANGUAGE="VBScript">
Sub Window_onLoad() Dim WSHShell Dim objNTInfo Dim GetComputerName
Set objNTInfo = CreateObject("WinNTSystemInfo") GetComputerName = lcase(objNTInfo.ComputerName) DataArea.InnerHTML = getcomputername End Sub
</SCRIPT>
<body>
<span id=DataArea></span> </body>
For more info on HTA's, check out the HTA Development Center
Good luck.
|