Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: robertpp am 11.04.06 - 07:59:17

Titel: Printing attachments in a Notes document
Beitrag von: robertpp am 11.04.06 - 07:59:17
Hallo,

Ich hab hier ein Script von Duffbert das mir alle Attachments (Word, Excel, Visio, Project, und txt-Datein )von einem Doc ausdruckt. Das Problem dabei ist das es leider keine PDF ausdruckt.

http://hostit1.connectria.com/twduff/home.nsf/plinks/TDUF-6FM2M5

Weiß jemand ob es möglich ist auch pdf's per Script auszudrucken?

Danke Robert
Titel: Re: Printing attachments in a Notes document
Beitrag von: madmaxxx4 am 11.04.06 - 08:21:02
Hallo Robert,

das geht genauso wie bei Word oder Excel.

Du benötigst den Acrobat Browser initialisierts diesen.

Diese Funktionen stellt das Arcobat control bereit:

Function LoadFile(fileName As String) As Boolean
    Member of AcroPDFLib.AcroPDF
    method LoadFile

Sub Print()
    Member of AcroPDFLib.AcroPDF
    method Print

Wie dieses Object unter VBA angesprochen wird bekommst Du auch irgend wie heraus CreateObject("?.?").
Titel: Re: Printing attachments in a Notes document
Beitrag von: Axel am 11.04.06 - 08:21:50
Ich habe in grauer Vorzeit mal das hier im Web gefunden. Ich habe es allerdings nie probiert.

Zitat
This is to print attachments in rich text fields based on their types and without user intervention.It can print, any
no of attachments in a rtf with just one click.For windows based lotus notes
  
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(Byval hwnd As Long, Byval lpszOp As String, _
Byval lpszFile As String, Byval lpszParams As String, _
Byval LpszDir As String, Byval FsShowCmd As Long) As Long
Declare Private Function GetDesktopWindow Lib "user32" () As Long
Private Const SW_HIDE = 0&
Dim ritem As Variant
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String

Sub PrintAttachment(doc As NotesDocument)
Dim ritem As Variant
Dim Scr_hDC As Long
Dim ret As Long
Dim file As String

Set ritem=doc.getfirstitem("Body")
If (ritem.type=RICHTEXT)Then
If Isarray(ritem.embeddedobjects) Then
Forall o In ritem.embeddedobjects
If (o.type=EMBED_ATTACHMENT) Then

Call o.extractfile (o.name)

extname=Right$(o.name,3)

If extname="tml" Or extname="TML" Then
extname=Right$(o.name,4)
End If

varobject = o.object
If extname="DOC" Or extname="doc" Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

If extname="XLS" Or extname="xls"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

if extname="PPT" Or extname="ppt"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

If extname="TXT" Or extname="txt"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

If extname="PDF" Or extname="pdf"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

If extname="HTML" Or extname="html"Then
file=o.name
call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

If extname="TIF" Or extname="tif"Then
file=o.name
Call o.ExtractFile( "c:\temp\" & file )
Scr_hDC = GetDesktopWindow()
ret = shellExecute(Scr_hDC, "print",file ,Null ,"c:\temp" ,SW_HIDE)
End If

End If
End Forall
End If
End If


End Sub


Axel
Titel: Re: Printing attachments in a Notes document
Beitrag von: Untitled am 11.04.06 - 08:26:25
Code
extname=Right$(o.name,3)

würde ich noch in

Code
extname=LCase(Right$(o.name,3))

ändern, damit unten nur noch

Code
If extname="xls"Then

geschrieben werden müsste.

Ausserdem wird dann zum Bleistift auch "Txt" gefressen, was zwar selten ist, aber auch vorkommen kann  ;D

Grüsse
Moritz
Titel: Re: Printing attachments in a Notes document
Beitrag von: robertpp am 12.04.06 - 11:32:15
Hallo,

So, da derzeit viel zu tun ist kann ich mich erst jetzt melden. Es funktioniert im Grunde genommen. Is muss mir nur noch ansehen wie ich den AcrobatReader wieder schließen kann.
Weiß das vielleicht jemand?

Ich hab auch einen Eintrag gefunden wo das gleiche Thema gehandelt wurde:
http://atnotes.de/index.php?topic=11856.0
Dort stellte sich die gleiche Frage mit dem schließen.

Danke robert