Showing posts with label VB Script. Show all posts
Showing posts with label VB Script. Show all posts

Friday, April 18, 2008

Map Network drive using Vbscript

' save this contents to MapNetwork.vbs
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath
strDriveLetter = "J:"
strRemotePath = "\\10.90.2.3\e$"

Set objNetwork = CreateObject("WScript.Network")

objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
WScript.Quit

Friday, April 4, 2008

Send Keys Representation

Key SendKeys Representation

BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
SHIFT +
CONTROL ^
ALT %
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}

Run application without User intervention

Suppose you want to run hyperterminal via command mode without user intervention.

The following vbs script is very useful for you..


' openhyper.vbs
' Example VBScript Run Notepad and use SendKeys
' -----------------------------------------------------'
' Developed by S.Murugan
Option Explicit
Dim objShell, Racey, intCount
Set objShell = CreateObject("WScript.Shell")
objShell.Run "hypertrm new.ht"
Wscript.Sleep 1500
Racey = 1000
intCount=0

objShell.SendKeys "%T"
WScript.Sleep 1500
objShell.SendKeys "C"
WScript.Sleep 1500
objShell.SendKeys "{TAB}"
WScript.Sleep 1500
objShell.SendKeys "{TAB}"
WScript.Sleep 1500
objShell.SendKeys "{ENTER}"

WScript.Quit
' End of Example SendKeys VBScript




Updated file

' hyperopen.vbs
' Example VBScript Run Notepad and use SendKeys
' -----------------------------------------------------'
Option Explicit
Dim objShell, Racey, intCount
Set objShell = CreateObject("WScript.Shell")
objShell.Run "hypertrm new.ht"
Wscript.Sleep 1500
Racey = 1000
intCount=0

objShell.SendKeys "%T"
WScript.Sleep 1500
objShell.SendKeys "C"
WScript.Sleep 1500
objShell.SendKeys "C:\Documents and Settings\murugans\Desktop\capture.txt"
WScript.Sleep 1500
objShell.SendKeys "{TAB}"
WScript.Sleep 1500
objShell.SendKeys "{TAB}"
WScript.Sleep 1500
objShell.SendKeys "{ENTER}"

WScript.Quit
' End of Example SendKeys VBScript




' stop the application new
' Example VBScript Run Notepad and use SendKeys
' -----------------------------------------------------'
Dim objshell
Set objShell = CreateObject("WScript.Shell")
While objShell.AppActivate("new") <> True
WScript.Sleep 500
Wend
WScript.Sleep 100
objShell.SendKeys "{ENTER}"

objShell.SendKeys "%F"
WScript.Sleep 1500
objShell.SendKeys "x"
WScript.Sleep 1500
objShell.SendKeys "{ENTER}"

WScript.Quit
' End of Example SendKeys VBScript