Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


vb scripts is causing error when in html

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1433
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> vb scripts is causing error when in html
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 vb scripts is causing error when in html - 10/6/2004 6:20:20 AM   
  cbosque

 

Posts: 5
Score: 0
Joined: 10/6/2004
From:
Status: offline
These two scripts work great when you save them and run them as .vbs
but if you embedd them in html code I can't get them to work. It keeps saying "error on page".

Thanks in advance,
Carlos

1.) Dim colProcessList, objProcess, strProcess
strProcess = "iexplore.exe"
Set colProcessList = GetObject("Winmgmts:").ExecQuery _
("Select * from Win32_Process Where Name ='" & strProcess & "'")
For Each objProcess in colProcessList
objProcess.Terminate( )
Next

2.) strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancecreationevent " _
& " within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.Name = "iexplore.exe" Then
objLatestProcess.TargetInstance.Terminate
End If
Loop
.....................................................................

Here is what the entire html page looks like.

<html>
<head><title>Test</title></head>
<script language = "vbscript">

Sub KillExplorer
Dim colProcessList, objProcess, strProcess
strProcess = "iexplore.exe"
Set colProcessList = GetObject("Winmgmts:").ExecQuery _
("Select * from Win32_Process Where Name ='" & strProcess & "'")
For Each objProcess in colProcessList
objProcess.Terminate( )
Next
End Sub

Sub DoIt
KillExplorer()
End Sub

</script>
<body>
<center>
<input type = "button" name = "test" value = "test" OnClick = DoIT>
</center>
</body>
</html>
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> vb scripts is causing error when in html Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts