Herunterladen Inhalt Inhalt Diese Seite drucken

LVBPrint PrintMulti Handbuch Seite 48

Inhaltsverzeichnis

Werbung

Der Nachrichtentext wird im Beispiel aus der festen Datei "mailbody.txt" genommen.
Falls "!GS_MAILLOGFILE" definiert ist, wird eine Logdatei geschrieben.
Der Schalter "!GS_SENDMAIL" entscheidet, ob überhaupt eine Mail geschickt werden soll. Er wird
auch im Script ausgewertet.
Falls der Schalter gesetzt ist, dann wird mit Hilfe des Befehls "WriteTextToFile" der unformatierte
Seitentext in eine Datei im Tempverzeichnis geschrieben.
Falls nicht, wird der Ausdruck zu einem Leerstring ausgewertet (zu sehen in der Logdatei) und in
diesem Fall ignoriert.
Der Name der Textdatei wird an die Umgebungsvariable "!GS_TEXTFILE" übergeben.
Die Textdatei wird übrigens im Script wieder gelöscht, damit keine überflüssigen Dateien zurück
bleiben.
Die Extraktion der Daten aus dem Quelltext wird im Script mit der Funktion "ExtractDataFromText"
durchgeführt.
Hier ein Ausschnitt aus dem Script.
' must be set in the printmulti.ini
sendMail = procEnv("GS_SENDMAIL")
' needs blat.exe in the PDFCreation folder
' needs CmdRedirect.exe in the PDFCreation folder (set above)
' adjust log file, user name and password
If sendMail = "1" Then
Dim blatExeFile, mailfile, subject, address, tempMailLogFile, mailLogFile
Dim mailserver, mailserveruser, mailserverpassword, mailreplyaddress, strContent
' get the name of the text file
textFileName = procEnv("GS_TEXTFILE")
' load the complete text into a variable
set textFile = fso.OpenTextFile(textFileName, ForReading, false, TriStateTrue)
strContent=textFile.ReadAll()
textFile.Close
' get the address and the subject from the printed text
address = ExtractDataFromText(strContent, "GS_MAILSENDERADDRESS")
subject = ExtractDataFromText(strContent, "GS_MAILSUBJECT")
blatExeFile=shell.ExpandEnvironmentStrings("%PM_INSTALLPATH%\PDFCreation\blat.exe")
' the rest is defined as constants in the PrintMulti.ini file
mailfile = procEnv("GS_MAILFILE")
mailLogFile = procEnv("GS_MAILLOGFILE")
mailserver = procEnv("GS_MAILSERVER")
mailserveruser = procEnv("GS_MAILSERVERUSER")
mailserverpassword = procEnv("GS_MAILSERVERPASSWORD")
mailreplyaddress = procEnv("GS_MAILREPLYADDRESS")
gsCmdLine = ...
shell.Run(gsCmdLine),0,true
If mailLogFile <> "" Then
AppendFile2File mailLogFile, tempMailLogFile, 2
Wscript.echo mailLogFile + ":Append:"+tempMailLogFile
fso.DeleteFile tempMailLogFile
End If
fso.DeleteFile textFileName
End if
48

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis