Home > Domino Tips > Developer > LotusScript > Simple method to select all/deselect all from LotusScript
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Simple method to select all/deselect all from LotusScript


Andrew Young
07.09.2003
Rating: -3.96- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

Code

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.


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
LotusScript
Display a custom message box using a LotusScript-generated button
Debug Lotus Notes documents using extracted data
Extracting attachments from a Lotus Notes rich-text field
Programmatically replace the design of Lotus Notes databases
Reading a binary field in an Oracle database with LotusScript
LotusScript equivalent of @Picklist for Lotus Notes
Launch large attachments within an email from a Notes database
How to find files on a hard drive or mapped network with LotusScript
Update the ACL from the Roles view with LotusScript
LotusScript agent moves tagged spam email to junk mail folder

LotusScript
Display a custom message box using a LotusScript-generated button
Can I use LotusScript to merge cells in a Microsoft Word table?
Debug Lotus Notes documents using extracted data
Extracting attachments from a Lotus Notes rich-text field
Programmatically replace the design of Lotus Notes databases
Reading a binary field in an Oracle database with LotusScript
LotusScript equivalent of @Picklist for Lotus Notes
Launch large attachments within an email from a Notes database
How to find files on a hard drive or mapped network with LotusScript
Update the ACL from the Roles view with LotusScript

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts