Pages

Tuesday, 30 August 2011

SendKeys using VBScript

Following script is an example of how to use SendKeys function available in VBScript to pass automated clicks to an application.


Application Window Name should be changed in the script according to application that you are working on.


On Error Resume Next

Set WshShell = CreateObject("WScript.Shell")
strWindowNameEN = "Application Window Name"

successEN = False
Do

successEN = WshShell.AppActivate(strWindowNameEN)
Loop Until (successEN = True)

If (successEN) Then
WshShell.AppActivate strWindowNameEN
End IF

WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"

No comments:

Post a Comment