Was curious to see if there was any way to print all attachments from a message without having to open them individually.
This would be a great time saver at work.
Was curious to see if there was any way to print all attachments from a message without having to open them individually.
This would be a great time saver at work.
Subject: not built in, but…
I don’t see why you couldn’t write a script to detach them all and use the OS or OLE automation to print them.
Subject: Printing. Oh well, don’t get me started … we are still heading for more paperless, I guess.
![]()
Anyhow, more seriously: I don’t think you will get something out of the box for printing attachments without having to open them first (to decide if they need printed).
If you need it, two ideas.
I have seen what looks like a fax machine but actually is a eMail client for those not really into computers. If you would have one of these, and would forward your mails to its Mailaddress (or ask the it folks to send it for this user there in parallel), you might find exactly what you need.
In at least some Windows OS, you could type in 'print to send something to the default printer. Could be a little project to try to automize the detatching etc.
Subject: We found a script for an agent
A while back we found a agent that does this. What this does is if there is an attachment included in the email, it will print the attachment without having to open the email. It looks at the attachment, then opens up the attachment in it proper program, then prints it out.
Use at your own risk. I make no guarantees that it’ll work for you, but it does for us.
Here is the code to put into your agent
(Declarations)
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SEE_MASK_FLAG_NO_UI = &H400
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Declare Function ShellExecuteEx Lib “shell32.dll”_
Alias “ShellExecuteEx” (SEI As SHELLEXECUTEINFO) As Long
Declare Function TerminateProcess Lib “kernel32”_
Alias “TerminateProcess” (Byval hProcess As Long, Byval uExitCode As Long) As Long
(Initialize)
Sub Initialize
On Error Goto ErrorHandler
Dim SEI As SHELLEXECUTEINFO
SEI.cbSize = Len(SEI)
SEI.fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_NO_UI
SEI.lpVerb = "print"
SEI.nShow = 1
SEI.hInstApp = 0
SEI.lpIDList = 0
Dim s As New NotesSession
Dim db As NotesDatabase
Dim object As NotesEmbeddedObject
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim downloadfolder As String
Dim extrachar As String
Dim filecounter As Integer
Dim filecount As Integer
Dim filen As Variant
Dim antalfiler As Variant
Dim i As Integer, x As Integer, y As Integer
Dim sFile As String
Dim uidoc As NotesUIDocument
Dim ws As New NotesUIWorkspace
Dim success As Variant
’ Create a folder for temporary storage of files
downloadfolder = Environ("tmp")
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
For i = 1 To dc.Count
Set doc = dc.GetNthDocument( i )
’ Print document
Set uidoc = ws.EditDocument( False , doc , True , )
Call uidoc.Print(1)
’ Get all attachments and print them
filen=Evaluate("@AttachmentNames",doc)
antalfiler=Evaluate("@Attachments", doc)
Call uidoc.Close
Delete uidoc
If antalfiler(0)>0 Then
For filecounter=0 To antalfiler(0)-1
x=x+1
Set Object = doc.GetAttachment( filen(filecounter) )
If ( object.Type = EMBED_ATTACHMENT ) Then
fileCount = fileCount + 1
If Dir(downloadfolder+"\"+ filen(filecounter))="" Then
extrachar=""
Else
’ Extra character in case there are attachments with the same name
extrachar=Left(doc.universalid,4)+"___"
End If
Call object.ExtractFile (downloadfolder+"\"+extrachar+ filen(filecounter) )
End If
Next filecounter
End If
For y = 0 To filecounter-1
sFile = downloadfolder+"\"+extrachar+ filen(y)
SEI.lpFile = sFile
Call ShellExecuteEx(SEI)
Sleep (5)
Next
’ Delete all files
Sleep (5)
For y = 0 To filecounter-1
sFile = downloadfolder+"\"+extrachar+ filen(y)
Kill sFile
Next
'Call TerminateProcess(SEI.hProcess, 0)
Next
Exit Sub
ErrorHandler:
Msgbox Error$ & " on line " & Cstr(Erl) & " in " & Lsi_info(12)
Exit Sub
End Sub
Subject: Interesting - thanks for sharing.