add a screenshot button in a hcl notes application or mailbox

HCL Notes and Domino: Tips & Tricks

Add a screenshot button in a HCL Notes application or mailbox
October 27, 2014

By Lance Zakin, HCL CASA, CAAD
Notes and Domino
NotesMail - HCL BP
A Domino developer might want to add a screenshot button in a Notes application or mailbox template if (1) Notes mailbox users have issues replying / forwarding to MIME HTML CSS emails, or (2) Notes app users have issues copy/pasting Notes app data to non-Notes mail client.

A Domino developer can use the LotusScript code below to implement, for example, a "Capture screenshot" button for end users.

Sub Click(Source As Button)
' Coded by NotesMail Consulting -
Const TITLE = "Capture screenshot"
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim result As Integer
Dim formula1 As Variant
Dim sysDrive, fileName, prog, msg As String
Dim Win64flag, choice As Boolean

Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
msg = "Press Alt-Print Screen (Alt-PrtSc) keys before clicking this button. After clicking button paste into Paint, select & cut, then paste into email. Continue?" & Chr(13) & Chr(13) & "NOTE: Snipping Tool runs on Windows 7/Vista or higher."

' Determine Windows version; MSFT Snipping Tool installed on Windows Vista (6.0) and higher
formula1 = Evaluate(|@TextToNumber(@Subset(@Subset(@Platform([Specific]); -2); 1))|, doc)
If formula1(0) < 6 Then prog = "mspaint.exe" Else prog = "C:\Windows\sysnative\SnippingTool.exe"
' Support Windows XP: Snipping Tool is not installed, so MSFT Paint will be launched instead
If formula1(0) < 6 Then
choice = ws.Prompt (PROMPT_YESNO, TITLE, msg)
If Not choice Then Exit Sub
End If

result = Shell(prog, 1)
End Sub

Reference Sources

Microsoft Snipping Tool
Snipping Tool is a screenshooting utility included in Windows Vista and later. It can take screenshots of an open window, rectangular areas, a free-form area, or the entire screen. Snips can then be annotated using a mouse or a tablet, stored as an image file (PNG, GIF, or JPEG file) or an MHTML file, or e-mailed. Snipping Tool allows for basic image editing of the snapshot, with different colored pens, an eraser, and a highlighter.

Microsoft Paint
Paint (formerly Paintbrush for Windows) is a simple graphics painting program that has been included with all versions of Microsoft Windows. It is often referred to as MS Paint or Microsoft Paint. The program opens and saves files as Windows bitmap (24-bit, 256 color, 16 color, and monochrome, all with the .bmp extension), JPEG, GIF (without animation or transparency, although the Windows 98 version, a Windows 95 upgrade, and the Windows NT4 version did support the latter), PNG (without alpha channel), and TIFF (without multiple page support).