Back

PowerBuilder - Answers - Triggering Keypresses


Sybase TechDoc ID : 47760

Using the Windows Scripting Host (WSH)

The next example shows you how to start Notepad and send some keys to it.

OleObject   wsh

Integer     li_rc


wsh = CREATE OleObject 

li_rc = wsh.ConnectToNewObject("WScript.Shell" )
wsh.Run("Notepad")
Sleep(500) 
wsh.AppActivate("Untitled - Notepad")
wsh.SendKeys("hello from PB")

If IsValid(wsh) Then
   Destroy(wsh)
End If

Make the Enter Key act like the Tab key (in a datawindow)

First, define a user event to correspond with the pbm_dwnprocessenter event on a datawindow. Then in that event :

Send(Handle(this),256,9,Long(0,0))
RETURN 1

 

Back