Jump to content

Ahnungslos

Members
  • Posts

    3
  • Joined

  • Last visited

Ahnungslos's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Ok. Thanks @all. ; Function Name: _StringToPDF() ; Description: Create PDF File _StringToPDF("Hello", "c:\mega.pdf") Func _StringToPDF($Text, $File = "MyPDF.pdf", $creator = "Creator", $producer = "Producer", $Size = "A4", $Rand_x = 20, $Rand_y = 24, $Schriftart = "Times-Roman", $Fett = 0, $Kursiv = 0, $Schrift = 12, $Autor = "unknown", $Titel = "Title") If $Size = "A4" Then $Size_x = 210 $Size_y = 297 ElseIf $Size = "A3" Then $Size_x = 420 $Size_y = 297 EndIf $Zeilen = 1 If $Fett = 1 Or $Kursiv = 1 Then If $Schriftart = "Times-Roman" Then If $Fett = 1 Then $Schriftart = "Times-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Times-Italic" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Times-BoldItalic" ElseIf $Schriftart = "Arial" Then If $Fett = 1 Then $Schriftart = "Helvetica-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Helvetica-Italic" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Arial,BoldItalic" Else If $Fett = 1 Then $Schriftart = "Courier-Bold" ElseIf $Kursiv = 1 Then $Schriftart = "Courier-Oblique" EndIf If $Fett = 1 And $Kursiv = 1 Then $Schriftart = "Courier-BoldOblique" EndIf EndIf $Abstand = Round($Schrift * 1.121861,3) If Not StringInStr($Text, @CRLF) = 0 Then $Text = StringSplit($Text, @CRLF) $Zeilen = $Text[0] / 21 EndIf Local $Wert = 2.834175 $Size_y = Round($Size_y * $Wert) $Size_x = Round($Size_x * $Wert) $Rand_x = Round($Rand_x * $Wert) $Rand_y = Round($Rand_y * $Wert) Local $pdf[47] = [ "%PDF-1.2", "%âãÏÓ", "1 0 obj", "<<","/Author (" & $Autor & ")", "/CreationDate (D:" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ")", _ "/Creator (" & $creator & ")","/Producer (" & $producer & ")", "/Title (" & $Titel & ")",">>", _ "endobj","4 0 obj","<<","/Type /Font", "/Subtype /Type1", "/Name /F1","/Encoding 5 0 R","/BaseFont /" & $Schriftart,">>", _ "endobj","5 0 obj","<<", "/Type /Encoding", "/BaseEncoding /WinAnsiEncoding",">>","endobj","6 0 obj","<<"," /Font << /F1 4 0 R >>", _ " /ProcSet [ /PDF /Text ]", ">>","endobj","7 0 obj","<<","/Type /Page","/Parent 3 0 R","/Resources 6 0 R","/Contents 8 0 R", _ "/Rotate 0", ">>","endobj","8 0 obj","<<","/Length 9 0 R",">>","stream","BT"] For $i=0 To UBound($pdf)-1 FileWriteLine($File, $pdf[$i] & @CRLF) Next If $Zeilen = 1 Then FileWriteLine($File, "/F1 " & $Schrift & " Tf") FileWriteLine($File, "1 0 0 1 " & $Rand_y & " " & $Size_y - $Rand_x - $Abstand & " Tm") FileWriteLine($File, "(" & $Text & ") Tj") Else For $Counter = 1 To $Zeilen FileWriteLine($File, "/F1 " & $Schrift & " Tf") FileWriteLine($File, "1 0 0 1 " & $Rand_y & " " & $Size_y - $Rand_x - $Abstand * $Counter & " Tm") FileWriteLine($File, "(" & $Text[$Counter * 2 - 1] & ") Tj") Next EndIf Local $pdf1[40] = ["ET","endstream", "endobj","9 0 obj","78","endobj", "2 0 obj", "<<", "/Type /Catalog", "/Pages 3 0 R", ">>", _ "endobj", "3 0 obj", "<<", "/Type /Pages", "/Count 1", "/MediaBox [ 0 0 " & $Size_x & " " & $Size_y & " ]", "/Kids [ 7 0 R ]", _ ">>", "endobj", "0 10", "0000000000 65535 f ", "0000000013 00000 n ", "0000000591 00000 n ", "0000000634 00000 n ", "0000000156 00000 n ", _ "0000000245 00000 n ","0000000307 00000 n ","0000000372 00000 n ", "0000000453 00000 n ", "0000000576 00000 n ", "trailer", _ "<<", "/Size 10", "/Root 2 0 R", "/Info 1 0 R", ">>", "startxref", "712", "%%EOF"] For $i=0 To UBound($pdf1)-1 FileWriteLine($File, $pdf1[$i] & @CRLF) Next EndFunc ;==>_StringToPDF More pdf functions are in work. Ich hoffe Tam0r und th.meger Ihr helft dabei (aber lieber in deutsch).
  2. $Word = ObjCreat("Word.Application") $Word.Documents.Open(@ScriptDir & "\Vorlagen\Mahnung.doc") With $Word.Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "%Ort%" .Replacement.Text = "Bad Blankenburg" .Forward = 1 .Wrap = 1 .Format = 0 .MatchCase = 0 .MatchWholeWord = 0 .MatchWildcards = 0 .MatchSoundsLike = 0 .MatchAllWordForms = 0 .Execute Replace: = 2 EndWith $Word.Activedocument.Save() $Word.Activedocument.Close In Zeile 16 nimmt AutoIt Replace: = 2 nicht an und in " " wird es von Word nicht angenommen. or: In line 16 AutoIt not take Replace: = 2 and in " " it is not accepted by Word.
×
×
  • Create New...