You can use NotesUIWorkspace PlayTune to play a sound from a Lotus Notes client.
However, this method requires you to already have the sound file on the client computer hard drive in a specific location, which isn't always possible or convenient. In this tip, I explain another way you can play a sound in Lotus Notes using Object Linking and Embedding (OLE) and LotusScript.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Open a Lotus Notes document in edit mode and put the cursor in a rich-text field.
Note: If this is a Lotus Notes email, anywhere in the body of the email will do.
- Choose the menu option "Create -> Object."
- Choose the "object from a file" option, browse to the wave file and click "OK."
- [OPTIONAL] Right-click the attached file (it should have an icon that looks like a stereo speaker). Choose the option "Object Properties" and then give the object a descriptive name.
- Add a space after the attached file icon and choose the menu option "Create -> Hotspot -> Button."
- Give the button a meaningful label, such as "Play Sound."
- The formula editor for this button should be visible on the bottom part of the screen. If it's not, right click the button and choose the option "Edit Button." Change the language type to LotusScript, and enter the following code:
Dim ws As New NotesUIWorkspace Dim doc As NotesDocument Set doc = ws.CurrentDocument.Document Forall obj In doc.EmbeddedObjects '** this will attempt to play all Sound Recorder objects If (obj.Class = "SoundRec") Then Call obj.DoVerb("&Play") End If '** this will attempt to play a specific object (use '** whatever name you used in step 4 above) 'If (obj.Name = "MySound") Then ' Call obj.DoVerb("&Play") 'End If End Forall
- Lastly, click somewhere else on the Lotus Notes document to get out of the script editor. Now either save the document, or send the email message, if it is an email.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Chandra Teja. 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.