Dear All,
I have produced the following script which when run (usually by
TaskScheduler at 6pm each day). It opens an IE page, shows an animated clock,
tells the user to click a button if they don't want the computer to shut down
after 30 seconds. If they don't click the button, then the PC shuts down. If
they do the script quits.
All the parts of the script work except the input button. Including this
line gives the error:
Line 31, Char 53, error Expected end of statement, code 800A0401, MS VBS
compliation error.
Any ideas what's wrong with this line?
If I ' the line out it works just fine.
======================== Shut Down Scriipt ==========
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM
Win32_OperatingSystem")
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
Set objExplorer = CreateObject _
("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Left = (intHorizontal - 400) / 2
objExplorer.Top = (intVertical - 200) / 2
objExplorer.Width = 400
objExplorer.Height = 200
objExplorer.Visible = 1
objExplorer.Document.Body.Style.Cursor = "wait"
objExplorer.Document.Title = "Logon script in progress"
objExplorer.Document.Body.InnerHTML = "<img
src='file:///E:\Artwork\Animations\MinuteClock.gif'> " & _
"This computer will SHUT DOWN in 30 Seconds. To cancel Shutdown please
click the STOP button"
objExplorer.Document.Body.InnerHTML = "<input type="button" value="STOP"
onClick="QuitScript">" 'this line stops the script working..
Wscript.Sleep 30000 'currently set to 30 seconds
objExplorer.Document.Body.InnerHTML = "Computer will now shut down.
Goodbye..."
'Lines below tabbed out for testing purposes.
'For Each objOperatingSystem in colOperatingSystems
' objOperatingSystem.Shutdown()
'Next
Sub QuitScript
Wscript.Quit
End Sub
=========================== End =====================
Thanks in advance for any help provided.
--
Cheers
Chas
***************
* Spectrum is Green *
***************