I have a script that has a single text box and a single button to continue. Right now you have to click the button or press tab and then enter. How can I send enter from the text box to continue? Thanks.
Also, a side question that may not have an answer. This is saved as an .hta and runs before a Windows Sysprep process. If it runs on a laptop, and the lid is closed when it starts, the screen is completely blank. I can press tab + enter to make it continue, as if I was seeing it, and then when it restarts its fine again. Any idea on why its blank and how to make it show always would be much appreciated.
<html>
<head>
<title>Sysprep Deployment</title>
<HTA:APPLICATION
ID="objCompDeploy"
APPLICATIONNAME="Sysprep Deployment"
SCROLL="no"
SINGLEINSTANCE="yes"
maximizeButton="no"
minimizeButton="no"
sysMenu="yes"
>
</head>
<SCRIPT LANGUAGE="VBScript">
Set WshShell = CreateObject("Wscript.Shell")
Sub Window_onLoad
window.resizeTo 400,200
ComputerNameArea.Focus
CreateObject("WScript.Shell").SendKeys "^{Home}"
'turn off setup flag in registry so we can query wmi
WshShell.RegWrite "HKLM\SYSTEM\Setup\SystemSetupInProgress", 0, "REG_DWORD"
'query wmi for serial number
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
serialNumber = objItem.SerialNumber
Next
'turn setup flag back on
WshShell.RegWrite "HKLM\SYSTEM\Setup\SystemSetupInProgress", 1, "REG_DWORD"
'put the serial number that was retrieved in the textbox
ComputerNameArea.Value = serialNumber
End Sub
Sub modUnattend
run_button.Disabled = True
Set fso = CreateObject("Scripting.FileSystemObject")
base = Wshshell.ExpandEnvironmentStrings("%SystemRoot%")
unattendFile = base & "\Panther\unattend.xml"
computerName = ComputerNameArea.Value
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.load unattendFile
'Iterate through Unattend.xml searching for nodes and properties to replace
Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/ComputerName")
For each n in oNodes
n.text = computerName
xmlDoc.save unattendFile
Next
'launch the continuation of setup in a hidden window and wait for return
'if we dont wait, closing mshta, closes windeploy.exe
WshShell.Run "%WINDIR%\System32\oobe\windeploy.exe", 0, True
idTimer = window.setTimeout("closeHTA", 5000, "VBScript")
End Sub
Sub closeHTA
window.close
End Sub
Sub commandLine
WshShell.Run "%WINDIR%\System32\cmd.exe", 1, True
End Sub
</SCRIPT>
<body>
<table border="0">
<tr>
<td>Computer Name:</td>
<td><input type="text" name="ComputerNameArea" size="30" maxlength="15" value="computer"></td>
</tr>
<tr>
<td>Tab then Enter to Continue</td>
</tr>
</table>
<p align="right">
<input id=runbutton class="button" type="button" value="Continue" name="run_button" onClick="modUnattend">
</body>
You can try with type Submit instead of button !
<input id=runbutton class="button" type="Submit" value="Continue" name="run_button" onClick="modUnattend">
I'm not 100% sure this will work, I added a EventListener to the enter key and and made it fire the click event when the enter key is pressed
<input id=runbutton class="button" type="button" value="Continue" name="run_button" onKeyDown="if (event.keyCode == 13){ this.click }" onClick="modUnattend">
Related
--------------------------------
In the above a selection is made from the lower input box populated from an array. On selection the corresponding index value from a second array is copied to the clipboard. A message box is used to advise user of value copied to clipbord but this is clunky. I added a second read only input box to display this value.
<input type="text" id = "Resulta)" / style="text-align:center;" readonly style='width:160px'/ value= bOpt(isel)>
The variable bOpt(isel) is not recognised as such being treated as text despite being unquoted. is there a simple way around this?
<html>
<head>
<HTA:Application ID="HTA"
ApplicationName="ListBox"
form name="myform"
onclick = 'Selected()'
<style type="text/css"> body {overflow-y:hidden;</style>
<style type="text/css"> body {overflow-x:hidden;</style>
Border="thin"
BorderStyle="normal"
Caption="no"
:::-webkit-scrollbar {
width: 0px; /* remove scrollbar space /
background: transparent; / optional: just make scrollbar invisible /
scroll = "no"
scrollflat = "no"
Icon=""
MaximizeButton="yes"
MinimizeButton="yes"
ShowInTaskBar="yes"
SingleInstance="yes"
SysMenu="no"
Version="1.0"
WindowState="maximize"
<script type="text/vbscript">
Option Explicit
Sub Document_OnKeyUp()
intKeyCode = Window.Event.Keycode
If intKeyCode = 27 Then Window.Close
End Sub
Dim aOpt, bOpt, iSel, iOpt, sOpt, messij
Sub Window_Onload()
Const cWid = 220
Const cHei = 122
window.resizeTo cWid, cHei
window.MoveTo screen.width/1-(cWid/1),screen.height/1-((cHei/1) + 40 )
document.parentwindow.clipboardData.SetData("TEXT"),"Fred#Email.com.au"
'<script language = "vbscript" type = "text/vbscript">
aOpt = Array("Fred email",_
"Bert email",_
"Sally email",_
"David email",_
"Peter emal")
bOpt = Array("Fred#Email.com.au" , _ "Bert#Email.com.au" , _
"Sally#Email.com.au" , _
"David#Email.com.au" , _
"Peter#Email.com.au")
sOpt = "<select id='entries' style='width:160px'>"
' & "<option selected>" & document.title & "</option>"
For iOpt = 0 To UBound(aOpt)
sOpt = sOpt & "<option>" & aOpt(iOpt) & "</option>"
Next
sOpt = sOpt & "</select><p>"
document.getElementById("opts").innerHTML = sOpt
End Sub
Sub Selected()
Dim iSel
iSel = document.getElementById("entries").selectedIndex
messij = "YOU SELECTED" & chr(13) & chr(13) & " " & aopt(isel) & chr(13) & chr(13) & "WHICH CAUSED THE VALUE" _
& chr(13) & chr(13) & " " & bopt(isel) & chr(13) & chr(13) & "TO BE COPIED TO THE CLIPBOARD"
'msgbox messij
document.parentwindow.clipboardData.SetData("TEXT"),bopt(isel)
End Sub
</script>
</head>
<body>
<input type="text" id = "Resulta)" / style="text-align:center;" readonly style='width:160px'/ value= bOpt(isel)>
<body>
<body bgColor="yellow">
<center>
<span id="resulta"></span>
<span id="opts"></span>
</center>
</html>
I put this in a sub
document.getElementById("fixit").value = bopt(isel)
which accepted the variable value and I modified my original input which treated the variable name as text by removing value = parameter
<input type="text" id = "fixit" / style="text-align:center;" readonlyx style='width:160px'>
Input box now loading successfully with variable values
I found my solution in another Stackoverflow question but cannot locate it again in order to acknowledge.
I added a Dim to get the escape key to correctly quit:
Dim intKeyCode
I removed the explicit value being set for input box:
value= bOpt(isel)
I renamed the Resulta) text box to Resulta (which necessitated renaming the later span from Resulta to Resultas to avoid duplicate names).
Then, finally, I explicitly put the value into Resulta in the Sub Selected code:
resulta.value = bOpt(iSel)
I'd never seen an onClick() event added in the HTA section before.
I have a HTA script for group membership information retrieval. I just started to learning HTA and tried my best to modify to fit my requirement
My Scripts does the below:
I have a static OU Named OU=MyDepartment,DC=org,DC=dev,DC=lab,DC=net
And all the Required / targeted AD groups will be located in above OU called MyDepartment .
From HTA Script I can select required AD group Name.
When I executed the HTA file it will Update "adminDescription" attribute in Active Directory to something I have hard coded in the script, and it works. However, am looking to update based on text box value which user can enter a value.
In the script below lines are executing to update required AD attribute i.e., "adminDescription" to "Scientist021".
Const ADS_PROPERTY_UPDATE = 2
Set objGroup = GetObject("LDAP://" & lst_groupfilter.Value)
objGroup.Put "adminDescription", "Scientist021"
objGroup.SetInfo
Currently I have configured to update this value when click on Get Members Button (I even wanted to rename this to button name to "UpdateValues".
I stuck at this place, I wanted to put value as "Scientist021" or whatever in the text which User can type in a text box
Can anyone guide me in this please.
Script can be downloaded from here.
<Html>
<Head>
<Title>Set Group AdminDescription</Title>
<HTA:Application
Caption = Yes
Border = Thick
ShowInTaskBar = Yes
SingleInstance = Yes
MaximizeButton = Yes
MinimizeButton = Yes>
<script Language = VBScript>
Const ADS_PROPERTY_UPDATE = 2
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
lst_members.Style.Width = 500
'Set objRootDSE = GetObject("LDAP://RootDSE")
Set objRootDSE = GetObject("LDAP://OU=MyDepartment,DC=org,DC=dev,DC=lab,DC=net")
strBaseConnString = objRootDSE.Get("distinguishedName")
Set objOULevel = GetObject("LDAP://" & strBaseConnString)
EnumerateGroups strBaseConnString
Show_Group_Selection
End Sub
Sub EnumerateGroups(strDNSDomain)
Const ADS_SCOPE_SUBTREE = 2
Const adVarChar = 200
Const MaxCharacters = 255
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT Name, distinguishedName FROM 'LDAP://" & strDNSDomain & "' WHERE objectClass='group'"
Set objRecordSet = objCommand.Execute
Set objDataList = CreateObject("ADOR.Recordset")
objDataList.Fields.Append "name", adVarChar, MaxCharacters
objDataList.Fields.Append "distinguishedName", adVarChar, MaxCharacters
objDataList.Open
While Not objRecordSet.EOF
objDataList.AddNew
objDataList("name") = objRecordSet.Fields("name").Value
objDataList("distinguishedName") = objRecordSet.Fields("distinguishedName").Value
objDataList.Update
objRecordSet.MoveNext
Wend
objRecordSet.Close
objDataList.Sort = "name"
objDataList.MoveFirst
While Not objDataList.EOF
Set objActiveOption = Document.CreateElement("OPTION")
objActiveOption.Text = objDataList.Fields("name").Value
objActiveOption.Value = objDataList.Fields("distinguishedName").Value
lst_GroupFilter.Add objActiveOption
objDataList.MoveNext
Wend
objDataList.Close
End Sub
Sub Show_Group_Selection
span_GroupFilter.InnerHTML = lst_GroupFilter.Value
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_run.Click
End If
End Sub
Sub Exit_HTA
Window.Close
End Sub
Sub Get_Members
'Const adVarChar = 200
'Const MaxCharacters = 255
Const ADS_PROPERTY_UPDATE = 2
Set objGroup = GetObject("LDAP://" & lst_groupfilter.Value)
objGroup.Put "adminDescription", "Scientist021"
objGroup.SetInfo
'Clear_Members
'Set objGroup = GetObject("LDAP://" & lst_groupfilter.Value)
'Set objDataList = CreateObject("ADOR.Recordset")
'objDataList.Fields.Append "name", adVarChar, MaxCharacters
'objDataList.Fields.Append "distinguishedName", adVarChar, MaxCharacters
'objDataList.Open
'For Each objObject In objGroup.Members
' objDataList.AddNew
' objDataList("name") = objObject.cn
' objDataList("distinguishedName") = objObject.distinguishedName
' objDataList.Update
'Next
'objDataList.Sort = "name"
'If Not objDataList.BOF Then objDataList.MoveFirst
'While Not objDataList.EOF
' Set objMember = Document.CreateElement("OPTION")
' objMember.Text = objDataList.Fields("name").Value
' objMember.Value = objDataList.Fields("distinguishedName").Value
' lst_members.Add objMember
' objDataList.MoveNext
'Wend
'objDataList.Close
End Sub
Sub ExporT_To_TXT
If Mid(document.location, 6, 3) = "///" Then
strHTAPath = Mid(Replace(Replace(document.location, "%20", " "), "/", "\"), 9)
Else
strHTAPath = Mid(Replace(Replace(document.location, "%20", " "), "/", "\"), 6)
End If
strFileName = Left(strHTAPath, InStrRev(strHTAPath, "\")) & lst_GroupFilter.Item(lst_GroupFilter.SelectedIndex).Text & ".txt"
strFileName = InputBox("Enter file name to save as:", "Save As", strFileName)
If strFileName <> "" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFileName, True)
objFile.WriteLine "Group Distinguished Name: " & lst_groupfilter.Value
For Each objOption In lst_members
objFile.WriteLine objOption.Text
Next
objFile.Close
MsgBox "File saved."
End If
End Sub
</script>
<body style="background-color:#B0C4DE;" onkeypress='vbs:Default_Buttons'>
<table height="90%" width= "90%" border="0" align="center">
<tr>
<td align="center" colspan="2">
<h2>Set Group AdminDescription</h2>
</td>
</tr>
<tr>
<td>
<b>Group Filter:</b>
</td>
<td>
<select size='1' name='lst_GroupFilter' onChange='vbs:Show_Group_Selection'>
</select>
</td>
</tr>
<tr>
<td colspan=2>
<b>Group Selected:</b>   <span id='span_GroupFilter'></span>
</td>
</tr>
<tr>
<td>
<b>Members:</b>
</td>
<td>
<select size='8' name='lst_members'>
</select>
</td>
</tr>
</table>
<table width= "90%" border="0" align="center">
<tr align="center">
<td>
<button name="btn_run" id="btn_run" accessKey="G" onclick="vbs:Get_Members"><u>G</u>et Members</button>
</td>
<td>
<button name="btn_export" id="btn_export" accessKey="E" onclick="vbs:Export_To_TXT"><u>E</u>xport to TXT</button>
</td>
<td>
<button name="btn_exit" id="btn_exit" accessKey="x" onclick="vbs:Exit_HTA">E<u>x</u>it</button>
</td>
</tr>
</table>
</body>
</head>
</html>
You should just be able to add a text box (not a select dropdown).
<input type=text id="userInput">
Then put the value from this box in the description
objGroup.Put "adminDescription", userInput.value
You'll just want to make sure to do validation in the text in this box (not empty, not too long, etc).
I am having trouble displaying a log file in the TextArea of a HTA while a robocopy script is running.
The script is simple enough, the user has one button to press to start the process, selects where they want to back up their data to, a Robocopy runs in the background and logs the work.
I cannot get the .log file to display live during the process and am always hit with an error 800A01B6.
Code below:
<html>
<head>
<title>Backup Script</title>
<HTA:APPLICATION
ID="Backup Script"
APPLICATIONNAME="Backup Script"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<SCRIPT Language="VBScript">
Sub Window_OnLoad
intWidth = 800
intHeight = 800
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
End Sub
Sub run_Backup_Script
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
Dim NetSharedFolder, TargetLocalFolder, Settings
'Delete Log File bigger than 10MB
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists("D:\Public\Backup.log") Then
Set file = oFSO.GetFile("D:\Public\Backup.log")
if file.Size >= 10485760 Then
oFSO.DeleteFile("D:\Public\Backup.log")
End If
End If
'Set Settings
Settings = " /MIR /FFT /R:3 /LOG+:D:\Public\Backup.log"
NetSharedFolder = "D:\LocalData\" & WshNetwork.UserName
'Select Target Folder
TargetLocalFolder = BrowseFolder( "Desktop", True , "Select a destination folder")
'Backup starts
objExecute = "RoboCopy.exe " & chr(34) & NetSharedFolder & chr(34) & " " & Chr(34) & TargetLocalFolder & chr(34) & " " & Settings & chr(34)
WshShell.Run objExecute, 0, True
DisplayOutput "D:\Public\Backup.log"
End Sub
'------------------------------------------------------------------------
Sub DisplayOutput(strFileName)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, 1, False)
BasicTextArea.Text = BasicTextArea.Text & VbCrLf & objFile.ReadAll
objFile.Close
End Sub
'------------------------------------------------------------------------
Function BrowseFolder( myStartLocation, blnSimpleDialog, myMessage )
Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0 ' Must ALWAYS be 0
Dim numOptions, objFolder, objFolderItem
Dim objPath, objShell, strPath, strPrompt
' Set the options for the dialog window
strPrompt = myMessage
If blnSimpleDialog = True Then
numOptions = 0 ' Simple dialog
Else
numOptions = &H10& ' Additional text field to type folder path
End If
' Create a Windows Shell object
Set objShell = CreateObject( "Shell.Application" )
' If specified, convert "My Computer" to a valid
' path for the Windows Shell's BrowseFolder method
If UCase( myStartLocation ) = "MY COMPUTER" Then
Set objFolder = objShell.Namespace( MY_COMPUTER )
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Else
strPath = myStartLocation
End If
Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _
numOptions, strPath )
' Quit if no folder was selected
If objFolder Is Nothing Then
BrowseFolder = ""
Exit Function
End If
' Retrieve the path of the selected folder
Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path
' Return the path of the selected folder
BrowseFolder = objPath
End Function
</SCRIPT>
'------------------------------------------------------------------------
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
<table width='90%' height = '50%' align='center' border='0'>
<tr>
<td align='center' colspan="4">
<h3>Backup Script</h3><br>
</td>
</tr
<tr>
<td align='center' colspan="2">
<table border="1">
<tr>
<td>
<input id="bt_Backup" type="button" value="Run Now" name="Run Now" onClick="vbs:run_Backup_Script">
</td>
</tr>
</table>
</body>
</br></br>
<textarea id="BasicTextArea" name="BasicTextArea" rows="5" cols="75"></textarea>
</html>
Can anyone see where I am going wrong?
I'm having an use where the <input type="file"> is locking the file for the ADODB.recordset.
If I hardcode the filepath the code runs without an issue however as soon as I browse using input type of file and select the hardcoded file it locks the file and I can no longer access it via the recordset.
I've tried just around everything I can think of without any success. I know its a result of the input browse function because if I select another file within the same directory or click the process button without browsing the code runs as it should.
Below is the relevant html and vbscript. Does anyone have any ideas on how to fix this?
<html>
<head>
<title>Employee Upload</title>
<HTA:APPLICATION
APPLICATIONNAME="Employee Upload"
ID="Employee Upload"
VERSION="1.0"/>
</head>
<body bgcolor="white">
<p id="heading" name="heading"><p>
<div id="container" name="container">
<span onClick="document.getElementById('myFile').click();" language="javascript" class="upload">
<button>Browse</button>
<input id="filename" type="text" disabled value="">
<input type="file" id="myFile" style="visibility:hidden;display:none;" onchange="document.getElementById('filename').value = this.value;document.getElementById('process').style.visibility = 'visible';" language="javascript">
</span>
<p>Click "Process File" once you have selected the file to upload the new hire data.</p>
<button id="process" name="process" onclick="loadFile()" style="/*visibility: hidden;*/">Process File</button>
</div>
<script language="vbscript">
Function loadFile()
On Error Resume Next
fileStr = document.all("filename").value
fileStr = "C:\Users\SeanW\Desktop\imports\NewHires.txt"
fileDir = Left(fileStr,InStrRev(fileStr,"\"))
filenameStr = Right(fileStr,Len(fileStr)-InStrRev(fileStr,"\"))
Set oConn = CreateObject("ADODB.Connection")
Set oRS = CreateObject("ADODB.Recordset")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & fileDir & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
oRS.Open "SELECT * FROM [" & filenameStr & "]", oConn, 3, 3, 1
If Err.Number <> 0 Then
MsgBox "Error Loading File: " & vbCrLf & vbCrLf & Err.Description,vbCritical,"File Load Error"
oConn.Close
oRS.Close
Set oConn = Nothing
Set oRs = Nothing
Err.Clear
Exit Function
else
Msgbox "File Loaded Successfully"
oConn.Close
oRS.Close
Set oConn = Nothing
Set oRs = Nothing
End If
End Function
</script>
</body>
</html>
I had exactly this problem today. I got around it by making a copy of the input file in a subfolder, then connecting to that with the ADODB.Connection
dim txtfile: txtfile = document.getElementById("filename").Value
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
dim tablename: tablename = fso.GetFileName(txtfile)
' we'll create the folder as a subfolder to the current one
dim currentfolder: currentfolder = fso.GetAbsolutePathName(".")
' create new paths until we have a new one
dim newpath: newpath = fso.BuildPath(currentfolder, fso.GetTempName())
do while fso.folderExists(newpath)
newpath = fso.BuildPath(currentfolder, fso.GetTempName())
loop
' create the folder & copy the input file
fso.createFolder newpath
fso.copyfile txtfile, fso.buildpath(newpath, tablename)
'connect and process
ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & newpath & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
ado.open
'... etc
' clear up the temp folder
fso.deleteFolder newpath, true
I'm trying to create a sort of persistent menu to place at the top of my WinPE image that offers: power off, restart and console access- In that order.
I have tried switching the order, switching names, switching images, changing associations, nothing I do will make more than two work at a time. Either power and admin work and restart doesn't, or restart and power work and admin doesn't, or admin and restart work and power doesn't.
Is there a limit on the amount of image inputs you can have or something?
<SCRIPT LANGUAGE="VBScript">
' Resize and center the window
' ==========================================================
sub DoResize
window.resizeTo 175,75
screenWidth = Document.ParentWindow.Screen.AvailWidth
screenHeight = Document.ParentWindow.Screen.AvailHeight
posLeft = (screenWidth - 100) / 2
posTop = (screenHeight - 100) / 2
window.moveTo posLeft, posTop
end Sub
DoResize()
' ==========================================================
</SCRIPT>
<HEAD>
<TITLE> </TITLE>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Options"
INNERBORDER="no"
BORDER="none"
CAPTION="no"
SCROLL="NO"
SHOWINTASKBAR="NO"
SINGLEINSTANCE="yes"
SYSMENU="NO"
WINDOWSTATE="normal">
</HEAD>
<BODY>
<body background="Options.png">
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Sub Power
Dim objShell
Dim ret
Set objShell = CreateObject("Wscript.Shell")
ret = MsgBox("Shut Down Computer?", vbYesNo, "Power Off")
If ret = 6 Then
objShell.Run "x:\windows\system32\cmd.exe /c wpeutil shutdown", 0, True
ElseIf ret = 7 Then
Exit Sub
End If
End Sub
Sub Reboot
Dim objShell
Dim ret
Set objShell = CreateObject("Wscript.Shell")
ret = MsgBox("Restart Computer?", vbYesNo, "Restart")
If ret = 6 Then
objShell.Run "x:\windows\system32\cmd.exe /c wpeutil reboot", 0, True
ElseIf ret = 7 Then
Exit Sub
End If
End Sub
Sub Admin
Dim objShell
Dim ret
Set objShell = CreateObject("Wscript.Shell")
ret = InputBox("Enter Admin Password", "Password Required")
If ret = "password" Then
objShell.Run "x:\windows\system32\cmd.exe /k"
ElseIf Not ret = "password" Then
MsgBox "Incorrect Password", vbOKOnly, "Access Denied"
End If
End Sub
</SCRIPT>
<input type="image" img src="power.png" name="power" size="48" onclick="Power">
<input type="image" img src="restart.png" name="reboot" size="48" onclick"Reboot">
<input type="image" img src="config.png" name="config" size="48" onclick="Admin">
</BODY>
There's a syntax error in the second <input> tag. Replace
<input type="image" ... onclick"Reboot">
with
<input type="image" ... onclick="Reboot">