Manage Learn to apply best practices and optimize your operations.

LotusScript accesses clipboard to view copied Notes documents

Find out how to access copied Lotus Notes documents on your clipboard with this downloadable LotusScript code. This tip is helpful when using queryPaste events to determine what content is being pasted into a Lotus Notes database.

You can access and examine clipboard data for copied Lotus Notes documents/design pieces to determine the nature of the content. What's more, you can match the Notes documents on the clipboard against existing documents, since they still have universal IDs intact.

Related resources from
Alternate version of @Command forwards subform via LotusScript

Dynamically update Lotus Notes rich-text fields using LotusScript

Top 10 LotusScript tips

The ability to check clipboard content can be useful when using queryPaste events to determine the nature of the content that's being pasted into the database. You can also use it as a temporary "dumping ground" for problem documents that you want to analyze using test agents -- without touching the original documents or modifying the test agent code.

Lotus Notes stores cut or copied documents and design pieces to a temporary database. To retrieve these documents, access a local temporary file called "~clipbrd.ncf" as a NotesDatabase object, and use this database's AllDocuments property. Here are two LotusScript code snippets, the first of which performs a copy/update to documents in the target database that have the same universal IDs.

LotusScript to access and examine clipboard data
(Click on code for enlarged view and script download.)

The second code snippet opens the clipboard in the Lotus Notes user interface.

LotusScript to access and examine clipboard data
(Click on code for enlarged view and script download.)

Note: You must add a form to the design -- or have documents with stored forms -- to fully open the documents. This exploits another undocumented feature, the UniversalID property of NotesView.

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

This tip was submitted to the tip library by member Rodney Rear. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...