{"id":3345,"date":"2023-11-30T10:20:58","date_gmt":"2023-11-30T09:20:58","guid":{"rendered":"https:\/\/bob-team.de\/wordpress\/?p=3345"},"modified":"2023-11-30T10:22:35","modified_gmt":"2023-11-30T09:22:35","slug":"referenzen-speichern","status":"publish","type":"post","link":"https:\/\/bob-team.de\/wordpress\/2023\/11\/30\/referenzen-speichern\/","title":{"rendered":"Referenzen speichern"},"content":{"rendered":"<pre lang=\"vbscript\">\r\nDim g_DirToHoldFiles\r\n\r\nFunction DPM_OnCreate(DCRoot)\r\n    g_DirToHoldFiles = \"E:\\temp\\referenz\"\r\nEnd Function\r\n\r\nFunction DPM_OnProcessDocument(DCDocument)\r\n    SaveTifAndAddx(DCDocument)\r\nEnd Function\r\n\r\nFunction SaveTifAndAddx(DCDocument)\r\n   'FileSystem-Objekt \u00f6ffnen\r\n   set fso = CreateObject(\"Scripting.FileSystemObject\")\r\n\r\n   'Verzeichnis\r\n   If not fso.FolderExists(g_DirToHoldFiles) Then\r\n      f = fso.CreateFolder(g_DirToHoldFiles)\r\n   End If\r\n\r\n   'Dateinamen\r\n   randname = g_dcRoot.GetRandomString(0)\r\n   tifFile = g_DirToHoldFiles & \"\\dvbes_referenz_\" & randname & \".tif\"\r\n   addxFile = g_DirToHoldFiles & \"\\dvbes_referenz_\" & randname & \".addx\"\r\n   ocrFile = g_DirToHoldFiles & \"\\dvbes_referenz_\" & randname & \".txt\"\r\n\r\n   'TIF exportieren\r\n   DCDocument.ExportImageFileW tifFile , 0\r\n   dcLog InfoLog, \"reference created: \" & tifFile\r\n\r\n   'ADDX erstellen\r\n   addxDoc = \"<ocr-document-result>\" & Chr(13) & Chr(10)\r\n   ocrText = \"\"\r\n\r\n   for pageNum = 0 to DCDocument.GetPageCount() - 1\r\n       set page = DCDocument.GetPage(pageNum)\r\n  \r\n       ocrPage =  page.Prop.GetStrW(\"PlainText\")\r\n       ocrText = ocrText & ocrPage & VBNewLine\r\n  \r\n       addxPage = page.Prop.GetStr(\"PlainTextClassify_ORIG\")\r\n  \r\n       if addxPage=\"\" then \r\n          addxPage = page.Prop.GetStr(\"PlainTextClassify\")\r\n       end if\r\n  \r\n       addxDoc = addxDoc & Left( addxPage, 12 ) & Chr(13) & Chr(10)\r\n       addxDoc = addxDoc & \"<page name=\" &#038; Chr(34)\r\n\r\n       PageNumStr = \"0000000\" &#038; pageNum\r\n       PageNumStr = Right( PageNumStr, 7 )\r\n\r\n       addxDoc = addxDoc &#038; PageNumStr &#038; Chr(34) &#038; \" \/>\"\r\n\r\n       if Len(addxPage)>12 then\r\n          addxDoc = addxDoc & Right(addxPage, Len(addxPage) - 12 ) & Chr(13) & Chr(10)\r\n       end if\r\n   next\r\n\r\n   addxDoc = addxDoc & \"<\/ocr-document-result>\"\r\n\r\n   'ADDX schreiben\r\n   set File = fso.OpenTextFile(addxFile, 2, true)\r\n   File.Write(addxDoc)\r\n   File.Close\r\n\r\n   'OCR schreiben\r\n   set File = fso.OpenTextFile(ocrFile , 2, true, -1)\r\n   File.Write(ocrText)\r\n   File.Close\r\n\r\n   'FileSystem-Objekt schlie\u00dfen\r\n   Set fso = Nothing\r\nEnd Function\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Dim g_DirToHoldFiles Function DPM_OnCreate(DCRoot) g_DirToHoldFiles = &#8222;E:\\temp\\referenz&#8220; End Function Function DPM_OnProcessDocument(DCDocument) SaveTifAndAddx(DCDocument) End Function Function SaveTifAndAddx(DCDocument) &#8218;FileSystem-Objekt \u00f6ffnen set fso = CreateObject(&#8222;Scripting.FileSystemObject&#8220;) &#8218;Verzeichnis If not fso.FolderExists(g_DirToHoldFiles) Then f = fso.CreateFolder(g_DirToHoldFiles) End If &#8218;Dateinamen randname = g_dcRoot.GetRandomString(0) tifFile = g_DirToHoldFiles &#038; &#8222;\\dvbes_referenz_&#8220; &#038; randname &#038; &#8222;.tif&#8220; addxFile = g_DirToHoldFiles &#038; &#8222;\\dvbes_referenz_&#8220; &#038; randname &#038; &#8222;.addx&#8220; ocrFile [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3345","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/comments?post=3345"}],"version-history":[{"count":3,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3345\/revisions"}],"predecessor-version":[{"id":3348,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3345\/revisions\/3348"}],"wp:attachment":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/media?parent=3345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/categories?post=3345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/tags?post=3345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}