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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.