SQL SAMSON

everything sql

Archive for the ‘vbs’ Category

VBScript References Part 1…

leave a comment »

[Display Standard Output]
Wscript.Echo “Hello Samson”

[Display to Message Box]
dim Msg
Msg=MsgBox(“Hello Samson!”,0,”VBS Example”)
0 = (vbOKOnly) Ok button only

dim Msg
Msg=MsgBox(“Hello Samson!”,2,”VBS Example”)
2 = (vbAbortRetryIgnore) Abort, Retry, & Ignore buttons

dim Msg
Msg=MsgBox(“Hello Samson!”,16,”VBS Example”)
16 = (vbCritical) Critical message icon

Set WshShell = Wscript.CreateObject(“Wscript.Shell”)
WshShell.Popup “Hello Samson!”,, “WshShell Popup”

Set WshShell = Wscript.CreateObject(“Wscript.Shell”)
WshShell.Popup “Hello Samson!”,3, “Close in 3 secs”,16
3 = Number of seconds to close, 16 = Critical message icon

Written by Samson Loo

November 6, 2008 at 11:39 pm

Posted in vbs

WshShell.SendKeys…VBS Script

leave a comment »

WshShell.SendKeys…if you think about it there are many things you can do with this. For instance you can turn on or off the CAPS LOCK, NUMLOCK and SCROLL LOCK keys or even write a quick note. I know writing a note is over the top and inefficient but it can be fun to play a trick on your co-workers, friends or family especially if you share a pc! Let’s get started…

The first thing you need to do is open up good ol’ notepad. Then copy and paste the following script into notepad.

‘Start Copy
Set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.Run “notepad”
WScript.Sleep 100 ‘This gives notepad sometime to open
WshShell.AppActivate “Notepad”
WScript.Sleep 500
x=0
   do while x < 100
      WshShell.SendKeys “I know what you did last summer!”
      WshShell.SendKeys “{ENTER}”
      WScript.Sleep 100
   x=x+1
loop
‘End Copy

then close notepad and when prompted save the file with what ever name of your liking, but change the extension from TXT to VBS. Then place it in your friend’s startup. Then the next time they log into their computer they will see notepad open and several lines of “I know what you did last summer!” will begin to write automagically! This is great for Halloween pranks!

Visit Winstructor to brush up on addtional functions…Website

Written by Samson Loo

August 12, 2008 at 2:45 am

Posted in sendkeys, vbs, wshShell