Manage Learn to apply best practices and optimize your operations.

Display a custom message box using a LotusScript-generated button

Use this LotusScript code to create a button featuring a customized message box that appears automatically after running a Lotus Notes application.

This LotusScript will display custom messages after running code in the background for any Lotus Notes document/data processing, email, etc. The LotusScript code will also close the window automatically -- without requiring any additional clicks.

To display a customized message box, you first must create a button on any Lotus Notes form that will call another Messagebox or Dialogbox. Then write the following code in an on-click event.

Note: This code can also be used in an agent, if needed.

Sub Click(Source As Button)
 Dim session As New NotesSession
 Dim workspace As New NotesUIWorkspace 
 Dim db As NotesDatabase
 Dim tempdoc As Notesdocument
 Set db = session.currentdatabase
 Set tempDoc = db.CreateDocument
 Call workspace.DialogBox( "msgBoxCloseAuto",
 True, True, True, True, False, False, 
"MessageBox Closing",TempDoc, True,True ) 
End Sub

After writing the code, follow these steps:

  • Create another form called msgBoxCloseAuto.
  • Enable the option "Automatically refresh fields."
  • Create a button and place it in a table.
  • Write the message that you want to be displayed in the button text.
  • Write the following code on the Postrecalc event of the msgBoxCloseAuto form.
Sub Postrecalc(Source As Notesuidocument)
 Sleep 3
 source.close
End Sub

This will display the second form as a Messagebox or Dialogbox, depending on which you select, and will close automatically after three seconds.

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

This tip was submitted to the SearchDomino.com tip library by member Vinay Sharma. 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.

This was last published in August 2008

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-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 ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close