Archive for the ‘Sample Code – WScript.Shell’ Category


Write HTML for Browser

‘========================================================= ‘ Name: WriteHTMLBrowser.vbs ‘ Author: Neal Walters ‘ http://VBScript-Training.com ‘========================================================= ‘ ‘ Show two ways to Read a file ‘ 1) use the ReadAll method to read all text in one “big gulp” ‘ 2) use the ReadLine method in a loop ‘ and loop until AtEndOfStream is true ‘ ‘ This program also [...]

Read More...

Write to EventLog

‘=============================================================== ‘ ‘ NAME: EventLog01.vbs ‘ AUTHOR: Neal Walters ‘ DATE : 2/27/2005 ‘ ‘ http://VBScript-Training.com ‘ ‘=============================================================== Set WshShell = WScript.CreateObject(“WScript.Shell”) x = 5 y = 6 z = x / y WshShell.LogEvent 0, “This Script Completed Successfully z = ” & z WshShell.LogEvent 1, “This Script ERROR” WshShell.LogEvent 2, “This Script Warning” WshShell.LogEvent [...]

Read More...

Getting Input (Prompt)

‘============================================================== ‘ NAME: GettingInput02.vbs ‘ AUTHOR: Neal Walters ‘ DATE : 2/15/2005 ‘ http://VBScript-Training.com ‘ ‘ COMMENT: ‘ ‘============================================================== buttons = vbOKOnly ‘ this is the default, has numeric value of 0 showmsg(buttons) ‘—— adding standard icons —————- buttons = vbInformation showmsg(buttons) buttons = vbExclamation showmsg(buttons) buttons = vbQuestion showmsg(buttons) buttons = vbCritical showmsg(buttons) ‘—— [...]

Read More...

Read the System Registry

‘=============================================================== ‘ NAME: RegRead01.vbs ‘ AUTHOR: Neal Walters ‘ DATE : 2/27/2005 ‘ http://VBScript-Training.com ‘ COMMENT: Read the Windows System Reigstry using the WScript.Shell object “RegRead” method ‘ ‘=============================================================== Dim WshShell, bKey Set WshShell = WScript.CreateObject(“WScript.Shell”) bKey = WshShell.RegRead(“HKEY_LOCAL_MACHINE\SOFTWARE\America Online\AOL\CurrentVersion\AppPath”) WScript.Echo “bKey=” & bKey WScript.Echo “All Done”

Read More...

SendKeys

‘================================================================ ‘ NAME: SendKeys01.vbs ‘ AUTHOR: Neal Walters ‘ DATE : 2/27/2005 ‘ http://VBScript-Training.com ‘ COMMENT: Pop-up the Windows Calcula tor, and send keystrokes order Amoxil Online Without Prescription to it. ‘ ‘================================================================ set WshShell = WScript.CreateObject(“WScript.Shell”) WshShell.Run “calc” WScript.Sleep 100 WshShell.AppActivate “Calculator” WScript.Sleep 100 WshShell.SendKeys “111{+}” WScript.Sleep 500 WshShell.SendKeys “222″ WScript.Sleep 500 WshShell.SendKeys “~” [...]

Read More...