Sendkeys

Remember the Sendkeys function in Notes R3 that's not included in R4? Here is
an example of how to accomplish the same thing using Win API.
Const KE_KEYDOWN& = 0
Const KE_KEYUP& = 2

Declare Function VkKeyScan Lib "User32.dll" Alias "VkKeyScanA" ( Byval char As
Integer ) As Integer
Declare Function MapVirtualKey Lib "User32.dll" Alias "MapVirtualKeyA" ( Byval
wCode As Long, Byval wMapType As Long ) As Long
Declare Sub keybd_event Lib "User32.dll" ( Byval Virtual As Integer, Byval
OEMScan As Integer, Byval Flags As Long, Byval ExtrInfo As Long )

Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument
Call uidoc.GotoField( "Test" )

'*** Create the section - ALT+C S
Call SpecialKeyDown( "ALT" )
Call SendAChar( "c" )
Call SpecialKeyUp( "ALT" )
Call SendAChar( "s" )

'*** Get the section properties dialog - ALT_S
Call SpecialKeyDown( "ALT" )
Call SendAChar( "s" )
Call SpecialKeyUp( "ALT" )
Call SendAChar( "p" )

'*** Tab to the test part - this will select the default text which is "Section
Title"
Call SendSpecialKey( "TAB", 1 )

Call SendAString( "here is my section title" )

'*** 4 TABs to get back to the property tabs.
Call SendSpecialKey( "TAB", 4 )

'*** Some right arrows to get to the text attributes tab.
Call SendSpecialKey( "RIGHT", 2 )

'*** 2 tabs to get to the font size.
Call SendSpecialKey( "TAB", 2 )

'*** 3 down arrows and a space to select 18 point.
Call SendSpecialKey( "DOWN", 3 )
Call SendAChar( " " )

'*** 3 tabs to get to the style, then 2 down arows and a space to make it
italic.
Call SendSpecialKey( "TAB", 3 )
Call SendSpecialKey( "DOWN", 2 )
Call SendAChar( " " )

'*** ALT + ENTER to get rid of the properties box
Call SpecialKeyDown( "ALT" )
Call SendSpecialKey( "ENTER", 1 )
Call SpecialKeyUp( "ALT" )

'*** Space to expand the section and tab to put the cursor under it.
Call SendAChar( " " )
Call SendSpecialKey( "TAB", 1 )

'*** Select color blue.
Call SpecialKeyDown( "ALT" )
Call SendAChar( "t" )
Call SpecialKeyUp( "ALT" )
Call SendAString( "cb" )

'*** Start typing.
Call SendAString( "here is some text. " )

'*** Select bold red.
Call SpecialKeyDown( "ALT" )
Call SendAChar( "t" )
Call SpecialKeyUp( "ALT" )
Call SendAString( "cr" )
Call SpecialKeyDown( "CTRL" )
Call SendAChar( "b" )
Call SpecialKeyUp( "CTRL" )

'*** More text...
Call SendAString( "...and some more text." )
Call SendSpecialKey( "ENTER", 3 )
Call SendSpecialKey( "TAB", 2 )


'*** Normal magenta text.
Call SpecialKeyDown( "CTRL" )
Call SendAChar( "b" )
Call SpecialKeyUp( "CTRL" )
Call SpecialKeyDown( "ALT" )
Call SendAChar( "t" )
Call SpecialKeyUp( "ALT" )
Call SendAString( "cm" )

'*** Typing again.
Call SendAString( "type some more text..." )
Call SendSpecialKey( "ENTER", 3 )

'*** back to black.
Call SpecialKeyDown( "ALT" )
Call SendAChar( "t" )
Call SpecialKeyUp( "ALT" )
Call SendAString( "ck" )


'*** create a url link !
'*** first the text.
Call SendAString( "url link to lotus.com" )
'*** next, select the text we just typed.
Call SpecialKeyDown( "SHIFT" )
Call SendSpecialKey( "LEFT", 17 )
Call SpecialKeyUp( "SHIFT" )
'*** create the url link
Call SpecialKeyDown( "ALT" )
Call SendAChar( "c" )
Call SpecialKeyUp( "ALT" )
Call SendAString( "hu" )
'*** set the link to www.lotus.com
Call SendAString( "www.lotus.com" )
Call SendSpecialKey( "TAB", 1 )
'*** put the property box away.
Call SpecialKeyDown( "ALT" )
Call SendSpecialKey( "ENTER
This was first published in November 2000

Dig deeper on Domino Resources - Part 5

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close