Simple method to select all/deselect all from LotusScript

This code snippet demonstrates using the Windows API to perform Edit -> Select All and Edit -> Deselect All actions from the Notes edit menu.

View member feedback to this tip.

This code snippet demonstrates using the Windows API to perform Edit->Select All and Edit->Deselect All actions from the Notes edit menu. You can change the arguments being passed to the subroutine keybd_event to simulate other keyboard actions.
Place in declarations:

Declare Sub keybd_event Lib 
"user32.dll" (Byval bVk As Integer, Byval bScan 
As Integer, Byval dwFlags As Integer,
Byval dwExtraInfo As Integer)

Place in shared action or wherever desired:

Dim workspace As New NotesUIWorkspace

'select all documents
 keybd_event 18,0,0,0 ' Alt key down
 keybd_event Asc("E"),0,0,0 ' E key down -- 
invokes file menu
 keybd_event Asc("A"),0,0,0 ' A key down - 
Select All
 keybd_event Asc("A"),0,2,0 ' A key up 
 keybd_event Asc("E"),0,2,0  'E key up 
 keybd_event 18,0,2,0 ' Alt key up 

'deselect all documents 
 keybd_event 18,0,0,0 ' Alt key down
 keybd_event Asc("E"),0,0,0 ' E key down
 keybd_event Asc("E"),0,2,0 ' E key up
 keybd_event 18,0,2,0 ' Alt key up 
 keybd_event Asc("D"),0,0,0 ' D key down
 keybd_event Asc("D"),0,2,0 ' D key up 
 Call workspace.ViewRefresh
For example, the following snippet of code would invoke the open database dialog:

                        keybd_event 18,0,0,0 '
 Alt key down
                        keybd_event Asc
("F"),0,0,0 ' F key down -- invokes
edit menu
                        keybd_event Asc
("D"),0,0,0 ' D key down - Database
menu
                        keybd_event Asc
("O"),0,0,0 ' O key down - open
database dialog
                        keybd_event 18,0,
0,0 ' Alt key down
                        keybd_event Asc("F"),
0,2,0 ' F key down -- invokes
edit menu
                        keybd_event Asc("D"),
0,2,0 ' D key down - Database
menu
                        keybd_event Asc("O"),0,
2,0 ' O key down - open
database dialog
                        keybd_event 18,0,2,0 '
 Alt key up

Users must be careful, however; if the last line of code, to lift up the Alt key, is not included, the keyboard will continue to function as if the Alt key is being held down.

MEMBER FEEDBACK TO THIS TIP

This method doesn't work with different Notes client languages. The sequence of keys is different.

-- Anonymous

*******************************

Great workaround for SendKeys(). I just want to know, if Andrew Young can do this in a few lines of code why can't Lotus make SendKeys() work in the Notes client? Good work, Andrew.

-- Dale F.

*******************************

The tip is good, but it's not NLS portable. The Windows key events are dependent on the NLS version of the Notes client.

-- Jesus M.

*******************************

The Select All code could be minimized a little more by bypassing the Edit menu, and using CTRL+A instead. No big difference, but a few less lines.

'select all documents
      keybd_event 17, 0, 0, 0 ' CTRL key down
      keybd_event Asc("A"), 0, 0, 0 ' A key down (Select All)
      keybd_event Asc("A"), 0, 2, 0 ' A key up
      keybd_event 17, 0, 2, 0 ' CTRL key up
Unfortunately, Notes does not have a Deselect all key.

-- Anonymous

*******************************

It does not work if you open another window after "deselect all" [e.g., UIWorkspace.ComposeDocument(...)].

-- Irina E.

*******************************

I just created a Smarticon to have a deselect icon with this code:

@Command([EditDeselectAll])
Works great. Of course, this is done after doing a CTRL-A to select all.

-- Anonymous


Do you have comments on this tip? Let us know.

This was first published in July 2003

Dig deeper on LotusScript

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

SearchWindowsServer

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

SearchDataCenter

SearchExchange

SearchContentManagement

Close