I need to position a popup box [duplicate] - vbscript

This question already has answers here:
MSGBOX position in WSH/VBS
(2 answers)
Closed 2 months ago.
I need to position the popup boxes towards the top right corner but just below the close minimize and maximize buttons.
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Do
set oLocator = CreateObject("WbemScripting.SWbemLocator")
set oServices = oLocator.ConnectServer(".","root\wmi")
set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
for each oResult in oResults
iFull = oResult.FullChargedCapacity
next
while (1)
set oResults = oServices.ExecQuery("select * from batterystatus")
for each oResult in oResults
iRemaining = oResult.RemainingCapacity
bCharging = oResult.Charging
next
iPercent = ((iRemaining / iFull) * 100) mod 100
if bCharging and (iPercent > 80) Then msgbox "Battery is charged now more than 80%. Please stop charging for optimal battery life."
if bCharging and (iPercent < 20) Then msgbox "Battery is discharging and is below 20%. Please switch on charging immediately."
if bcharging then
CreateObject("WScript.Shell").Popup "Charging", 1, "Charging status"
else
end if
if not bcharging then
CreateObject("WScript.Shell").Popup "Not charging", 1, "Charging status"
end if
wend
WScript.Quit 1
WScript.Sleep 0
Loop
I've tried testing different scripts to position it, but they never work.

The script needs to be written as an HTA in order to have a display that remains on screen, in a desired position, and updates on an interval. Here is your script rewritten to do that (save this as something like Battery.hta):
<!DOCTYPE html>
<html>
<head>
<title>Battery Status</title>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9">
<hta:application
id=oHTA
icon=perfmon.exe
maximizeButton=no
minimizeButton=no
contextmenu=no
showintaskbar=no
scroll=no
caption=yes
border=
>
<script language="VBScript">
'In the section above, change to caption=no and border=none for a minimal interface
'Alt-F4 can be used to quit the script when there is no caption
If oHTA.caption="no" And oHTA.border="none" Then x = 40
w=200: h1=75-x: h2=110-x
Window.ResizeTo w, h1
Window.MoveTo (screen.availWidth - w), 0
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
Set oServices = oLocator.ConnectServer(".","root\wmi")
Set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
For Each oResult in oResults
iFull = oResult.FullChargedCapacity
Next
Sub window_onload
UpdateBattery()
UpdateBatteryHandle = Window.SetInterval("UpdateBattery()", 10000) 'Every 10 seconds
End Sub
Sub window_unonload
ClearInterval(UpdateBatteryHandle) 'Not really needed
End Sub
Sub UpdateBattery
Set oResults = oServices.ExecQuery("select * from batterystatus")
For Each oResult In oResults
iRemaining = oResult.RemainingCapacity
bCharging = oResult.Charging
Next
iPercent = Int(iRemaining/iFull * 100)
Msg1.InnerText = iPercent & "% (Not Charging)"
Msg2.InnerText = ""
Window.ResizeTo w, h1
If bCharging Then
Msg1.InnerText = iPercent & "% (Charging)"
If iPercent>80 Then
Msg2.InnerText = "Please stop charging to preserve battery life."
Window.ResizeTo w, h2
End If
Else
If iPercent<20 Then
Msg2.InnerText = "Battery is low. Please start charging."
Window.ResizeTo w, h2
End If
End If
End Sub
</script>
<style>
body {color:White; background-color:Black; font-family:Segoe UI; font-size:9pt}
.TopM {margin-top:4pt}
</style>
</head>
<body>
<div id=msg1></div>
<div id=msg2 class=TopM></div>
</body>
</html>

Related

HTA/VBScript specific file download error possibly due to size

I've been trying to figure out this issue for 3 days now and I want to hurt myself.
I built a little utility to download files from a server. The script simply loops through a list of user-entered serials and appends each into the file url. It seems to perform fine for the most part until it hits a large file. "Large" being the third serial which is the one and only test case of 500mb I've encountered. The first two are less than 20mb. The smaller files download fine, but the larger file throws a "Not enough memory resources are available to complete this operation." error. I have 16gb of ram (barely utilized) and more than enough storage space.
Here's the really strange part, if I only attempt to download the 500mb file (enter only the last serial), sometimes it works. I cannot conclude what the cause is.
I've included a heavily stripped version of my code. I thought pulling pieces out might resolve the issue or at least shed some light, but it persists. I'd be grateful to anyone that can help me resolve this.
To recreate, copy my script below into a text file and rename extension from .txt to .hta. To use, enter the 3 serials below (including commas) into the text box and click download. The script creates the directory "C:\Downloads" and places downloaded files within:
Serials:
BLES01294,BCES00510,BLUS30109
My hta script:
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html style="display: inline-block;" id="mainHTML">
<head>
<meta http-equiv="x-ua-compatible" content="ie=9"/>
<title>Download Tool</title>
<!--Styles defined for doc (end)-->
<!--Scripts to control app window size, position, and behavior (start)-->
<script language="VBScript">
window.resizeTo 500,300
screenWidth = document.parentwindow.screen.availwidth
screenHeight = document.parentwindow.screen.availheight
posLeft = (screenWidth - 800) / 2
posTop = (screenHeight - 600) / 2
window.moveTo posLeft, posTop
</script>
<!--Scripts to control app window size, position, and behavior (end)-->
<!--Features of app window (start)-->
<HTA:APPLICATION ID="download tool"
APPLICATIONNAME="download tool
version="ver.2020.4.13"
CAPTION="yes"
BORDER="thin"
BORDERSTYLE="none"
ICON=""
CONTEXTMENU="yes"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="yes"
NAVIGABLE="no"
SCROLL="no"
SCROLLFLAT="no"
SELECTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal">
</head>
<!--Features of app window (end)-->
<body style="display: inline-block;" id="mainBody" >
<div id="Menu" style="display: inline;"><br>
<center>
<span style="display:inline-block;" id="Span_APIText">
<center>
<Span style="display: inline-block;">
<span >
<textarea style="width:70%;" class="apitextarea" name="txtPS3SerialEntry" rows=6 id="txtPS3SerialEntry"/></textarea>
</span>
<span id="Span_Buttons2" style="display: inline-block;">
<br><br><button id="GetGameDataBtn" title="Browse for download directory" onclick="dataValidation()"><br>Download</button>
</span>
</span>
</center>
</span>
</center>
</div>
</div>
</body>
</html>
<script language="VBScript">
'=================================================
Function dataValidation()
'on error resume next
noBlanks = ""
EntryTest = trim(ucase(document.getelementbyID("txtPS3SerialEntry").value))
if EntryTest = "" then
alert "No valid API numbers found in list"
exit function
elseif EntryTest <> "" then
document.getelementbyID("txtPS3SerialEntry").value = replace(EntryTest,",",vblf)
chkBlankLines = split(document.getelementbyID("txtPS3SerialEntry").value,vblf)
else
chkBlankLines = split(document.getelementbyID("txtPS3SerialEntry").value,vblf)
end if
for i = 0 to Ubound(chkBlankLines)
If Len(trim(chkBlankLines(i))) > 0 then
noBlanks = noBlanks & chkBlankLines(i) & vbcrlf
End If
Next
if noBlanks = "" then
alert "No valid API numbers found in list"
exit function
Else
document.getelementbyID("txtPS3SerialEntry").value = trim(noBlanks)
End If
chkNumeric = split(document.getelementbyID("txtPS3SerialEntry").value,vblf)
call getFiles()
end function
'========================================================
Sub ccSleep(seconds)
set oShell = CreateObject("Wscript.Shell")
cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul"
oShell.Run cmd,0,1
End Sub
'============================================================
Function ConvertSize(byteSize)
dim Size
Size = byteSize
Do While InStr(Size,",") 'Remove commas from size
CommaLocate = InStr(Size,",")
Size = Mid(Size,1,CommaLocate - 1) & _
Mid(Size,CommaLocate + 1,Len(Size) - CommaLocate)
Loop
Suffix = " Bytes"
If Size >= 1024 Then suffix = " KB"
If Size >= 1048576 Then suffix = " MB"
If Size >= 1073741824 Then suffix = " GB"
If Size >= 1099511627776 Then suffix = " TB"
Select Case Suffix
Case " KB" Size = Round(Size / 1024, 1)
Case " MB" Size = Round(Size / 1048576, 1)
Case " GB" Size = Round(Size / 1073741824, 1)
Case " TB" Size = Round(Size / 1099511627776, 1)
End Select
ConvertSize = Size & Suffix
End Function
'========================================================================
'Main Function Start
'========================================================================
function GetFiles()
'on error resume next
Set fso = CreateObject("Scripting.FileSystemObject")
path = "c:\Downloads" 'fso.BuildPath("c:\Downloads","")
If NOT fso.FolderExists(path & "\") then
fso.CreateFolder(path & "\")
end if
arrStr = split(ucase(document.getelementbyID("txtPS3SerialEntry").value),vbLf)
APICount = Ubound(arrStr)
for i = 0 to Ubound(arrStr)
API = trim(arrStr(i))
if API <> "" then
Set IE = CreateObject("internetexplorer.application")
IE.Visible = false
IE.Navigate replace("https://a0.ww.np.dl.playstation.net/tpl/np/{game_id}/{game_id}-ver.xml","{game_id}",API)
Do While IE.Busy or IE.ReadyState <> 4: ccSleep(1): Loop
Do Until IE.Document.ReadyState = "complete": ccSleep(1): Loop
on error resume next
ie.document.getelementbyid("overridelink").click
on error goto 0
Do While IE.Busy or IE.ReadyState <> 4: ccSleep(1): Loop
Do Until IE.Document.ReadyState = "complete": ccSleep(1): Loop
'============================================================
id = API
'============================================================
'Grab xml elements from site
for each a in ie.document.getelementsbytagname("package")
ps3ver = a.getattribute("ps3_system_ver")
url = a.getattribute("url")
strFileSize = convertsize(a.getattribute("size"))
ver = a.getattribute("version")
strFileName = mid(url,instrrev(url,"/")+1)
'============================================================
filename = "c:\Downloads\" & strFileName
msgbox "Getting file: " & strFileName & " (" & strFileSize & ")"
Set xHttp = createobject("Microsoft.XMLHTTP")
Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", url, false
xHttp.Send
'on error resume next
with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile filename, 2 '//overwrite
.close
end with
'on error goto 0
'----------------------------------------------------------------
Next
end if
Next 'APICount
ie.quit
end function
'========================================================================
</script>

Batch file opening htm in IE11 with set parameters

The following code worked pre-Windows 10 to open a htm file in Internet Explorer set to specific size and screen position. Now in Windows 10 and IE11 I get multiple errors popup and the IE box size and position are not size. Any suggestions?
Batch File
Main()
Sub Main()
Force32bit()
Dim objExplorer : Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "G:\operational.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 280
objExplorer.Height = 1160
objExplorer.Left = 1645
objExplorer.Top = 0
objExplorer.Visible = 1
objExplorer.Menubar = 0
objExplorer.Resizable = 1
End Sub
Sub Force32bit()
If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 and CreateObject("Scripting.FileSystemObject").FolderExists("C:\Windows\SysWOW64") Then
Dim objShell : Set objShell = CreateObject("WScript.Shell")
objShell.CurrentDirectory = "C:\Windows\SysWOW64"
objShell.Run "wscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34), 1, False
End If
End Sub
operational.htm
This is a plain HTML document with shortcut links to resources on the local drive and internet.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Operator</title>
<link rel="stylesheet" href="../css/styles.css" type="text/css" />
<script type="text/javascript">
tday =new Array("Sun","Mon","Tues","Wed","Thurs","Fri","Sat");
tmonth=new Array("Jan","Feb","March","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");
function GetClock(){
d = new Date();
nday = d.getDay();
nmonth = d.getMonth();
ndate = d.getDate();
nyear = d.getYear();
nhour = d.getHours();
nmin = d.getMinutes();
if(nyear<1000) nyear=nyear+1900;
if(nmin <= 9){nmin="0"+nmin}
<!--+(nmonth+1)+-->
document.getElementById('clockbox').innerHTML=""+nhour+":"+nmin+"hrs "+tday[nday]+", "+ndate+" "+tmonth[nmonth]+" "+nyear+"";
setTimeout("GetClock()", 1000);
}
window.onload=GetClock;
</script>
<script type="text/javascript">
function hideshow(which){
if (!document.getElementById)
return
if (which.style.display=="block")
which.style.display="none"
else
which.style.display="block"
}
</script>
</head>
<body class="body">
<div id="clockbox""></div>
<br><B>MENU</b>
<h1>Options</h1>
....
</body></html>
I tried this code for testing but get a Windows Script Host error Line 8 Char 1 'unspecified error' error code 80004005.
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate "testing.htm"
objIE.ToolBar = 0
objIE.Menubar = 1
objIE.StatusBar = 0
objIE.Width = 280
objIE.Resizable = 1
objIE.Height = 600
objIE.Top = 10
On Error Resume Next
Do
If objIE.ReadyState = 4 Then
If Err = 0 Then
Exit Do
Else
Err.Clear
End If
End If
WScript.Sleep 10
Loop
On Error Goto 0

Sort listbox entries by name

I've setup a VBScript hta to let my users choose a default printer. I'm currently trying to make it as clear as possible visually.
Our printers are listed as similar to:
4th floor
1st floor
Block 2
3rd floor
etc.
Is anyone aware of a change I could make to the code to sort the output of these by name? Many thanks
<html>
<head>
<title>Choose your default printer</title>
<style type="text/css">
body {
font-family:Verdana;
font-size: 12px;
color: #49403B;
background: #FFFFFF;
text-align: center;
}
</style>
<SCRIPT Language="VBScript">
Sub Window_Onload
window.resizeTo 500,550
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
Set re = New RegExp
re.Pattern = "^\\\\.*?\\"
For Each objPrinter in colPrinters
strPrinter = objPrinter.Name
Set objOption = Document.createElement("OPTION")
objOption.Text = re.Replace(strprinter, "")
objOption.Value = strPrinter
If objPrinter.Default Then objOption.Selected = True
AvailablePrinters.Add(objOption)
Next
End Sub
Sub SetDefault
strPrinter = AvailablePrinters.Value
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.SetDefaultPrinter strPrinter
Msgbox strprinter & " has been set as your default printer."
End Sub
</SCRIPT>
Click a printer name to set it as your default<p>
<select size="20" name="AvailablePrinters" onChange="SetDefault"></select>
<p>
Close this window when done
I'd use an ArrayList and a Dictionary, like this:
Set printerNames = CreateObject("System.Collections.ArrayList")
Set printers = CreateObject("Scripting.Dictionary")
For Each objPrinter in colPrinters
name = re.Replace(objPrinter.Name, "")
printerNames.Add name
printers.Add name, objPrinter
Next
printerNames.Sort
For Each name in printerNames
Set objOption = Document.createElement("OPTION")
objOption.Text = name
objOption.Value = printers(name).Name
If printers(name).Default Then objOption.Selected = True
AvailablePrinters.Add(objOption)
Next
You could add the printer names to an array and then use a simple bubble sort. The only tricky part is that you also obtain the default printer. So you'd have to save that while iterating your Win32_Printer collection.
' Create an array to hold the printer names...
ReDim a(colPrinters.count - 1)
' Add each printer name to the array. Also, save the name of the default printer.
Dim i, strDefault
For Each objPrinter In colPrinters
a(i) = objPrinter.Name
If objPrinter.Default Then strDefault = objPrinter.Name
i = i + 1
Next
' Sort the array...
Sort a
For i = 0 To UBound(a)
' Create your <option>...
If a(i) = strDefault Then objOption.Selected = True
Next
' Basic bubble sort...
Sub Sort(a)
Dim i, j, temp
For i = UBound(a) - 1 To 0 Step -1
For j = 0 To i
If a(j) > a(j + 1) Then
temp = a(j + 1)
a(j + 1) = a(j)
a(j) = temp
End If
Next
Next
End Sub
Here's a code fragment that reads from stdin, adds to a disconnected recordset, sorts recordset, reads and writesto stdout.
With rs
.Fields.Append "SortKey", 201, 260
.Fields.Append "Txt", 201, 5000
.Open
Do Until Inp.AtEndOfStream
Lne = Inp.readline
SortKey = Mid(Lne, Arg(3), Arg(4) - Arg(3))
.AddNew
.Fields("SortKey").value = SortKey
.Fields("Txt").value = Lne
.UpDate
Loop
If Arg(2) = "a" then SortColumn = "SortKey ASC"
If Arg(2) = "d" then SortColumn = "SortKey DESC"
.Sort = SortColumn
Do While not .EOF
Outp.writeline .Fields("Txt").Value
.MoveNext
Loop
End With
or you can use the .net sorted array/collection.
Set sortthing = CreateObject("System.Collections.SortedList")
See SortedList Class in .NET framework docs.

MSGbox in VBS that updates with value of variable

Just wondering how i could have a MSgbox that displays the value of a variable as it constantly changes. Basically a number has one added to it everytime it loops. I want to display that in a MSGbox that doesnt have to open a million windows
A workaround would be to use PopUp
Set objShell = WScript.CreateObject("WScript.Shell")
For i = 1 To 3
objShell.Popup i, 1, "AutoClose MsgBox Simulation", vbInformation+vbOKOnly
Next
This will "autoclose" the MsgBox lookalike after 1 second
You can't do this with the default VBScript dialog elements, like MsgBox, WScript.Echo or Popup. You need to build a custom dialog using the Internet Explorer COM object:
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
While ie.ReadyState <> 4 : WScript.Sleep 100 : Wend
ie.ToolBar = False
ie.StatusBar = False
ie.Width = 300
ie.Height = 200
ie.document.body.innerHTML = "<p id='msg'>0</p>"
Set style = ie.document.CreateStyleSheet
style.AddRule "p", "text-align: center;"
ie.Visible = True
i = 1
Do
ie.document.getElementById("msg").innerText = i
i = i + 1
WScript.Sleep 2000
Loop Until i > 10
or use an HTA instead of plain VBScript:
<head>
<title>Test</title>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="Test"
SCROLL="no"
>
</head>
<style type="text/css">
p {text-align: center;}
</style>
<script language="VBScript">
window.resizeTo 300, 200
Set sh = CreateObject("WScript.Shell")
Sub Window_onLoad
For i = 1 To 10
msg.innerText = i
Sleep 2
Next
End Sub
Sub Sleep(t)
sh.Run "ping -n " & (t+1) & " 127.0.0.1", 0, True
End Sub
</script>
<body>
<p id="msg">0</p>
</body>
One more solution, uses HTA window, without temp files:
dim window, i
set window = createwindow()
window.document.write "<html><body bgcolor=buttonface>Current loop is: <span id='output'></span></body></html>"
window.document.title = "Processing..."
window.resizeto 300, 150
window.moveto 200, 200
for i = 0 to 32767
show i
' your code here
next
window.close
function show(value)
on error resume next
window.output.innerhtml = value
if err then wscript.quit
end function
function createwindow()
' source http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
dim signature, shellwnd, proc
on error resume next
set createwindow = nothing
signature = left(createobject("Scriptlet.TypeLib").guid, 38)
set proc = createobject("WScript.Shell").exec("mshta about:""<script>moveTo(-32000,-32000);</script><hta:application id=app border=dialog minimizebutton=no maximizebutton=no scroll=no showintaskbar=yes contextmenu=no selection=no innerborder=no /><object id='shellwindow' classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'><param name=RegisterAsBrowser value=1></object><script>shellwindow.putproperty('" & signature & "',document.parentWindow);</script>""")
do
if proc.status > 0 then exit function
for each shellwnd in createobject("Shell.Application").windows
set createwindow = shellwnd.getproperty(signature)
if err.number = 0 then exit function
err.clear
next
loop
end function
This script will display how many loops it took and the value of a variable during the loop, and display the results in 1 message box after the loop is complete.
Dim RateOfChange, roc, watchvariable : roc = 1 : watchvariable = 1
for i=1 to 25
watchvariable = (watchvariable * i) * 16
RateOfChange = RateOfChange & "Iteration[" & roc & "]" & " - Value[" & watchvariable & "]" & vbcrlf
roc = roc + 1
next
'NOTE uncomment this below to activate msgbox.
'msgbox rateofchange
wscript.echo rateofchange

Of 3 image buttons, only 2 work

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">

Resources