Kinda new to autoit. I have this situation where I need to take the print output from a dos program and split the pages apart so it will print properly. This is a 25+ year old program, running in DosBox. The issue is that when printing statements the next page will start on the first, and so on. I've tried different dos->windows printer type programs and none of them will split the pages apart properly.
I had this working at one point but some changes in their system have removed that possibility.
I believe a simple autoit script could do this.
My thinking was something like this:
Read the text file - Easy
Split the pages - Eh
Print the pages -
It's been a while since I've done any coding but I can't figure out how to split the pages apart. Each page starts out "COMPANY NAME, INC". I can split around that but I lose that line or "COMPANY NAME, INC" depending on which method.
Anyone have an idea on splitting?
I found this code
#include <File.au3> Global $FileArray $file = @ScriptDir & "\test.txt" ;"C:\SBT\Incoming\SBTFILE.txt" $newfile = @ScriptDir & "\split-" ; "C:\SBT\Work\SBTFILE-" _FileReadToArray($file, $FileArray) $filecount = 1 $sNewFile_Text = "" ProgressOn("Processing SBT File", "Reading The File...", "0 Lines") For $i = 1 To $FileArray[0] If StringInStr($FileArray[$i], "****** END OF REPORT ******") Then ; We need to write the current file FileWrite($newfile & $filecount & ".txt", $sNewFile_Text & $FileArray[$i]) ; And start a new one $filecount = $filecount + 1 $sNewFile_Text = "" Else ; Add line to string $sNewFile_Text &= $FileArray[$i] & @CRLF EndIf $Percent = Int(($i / $FileArray[0]) * 100) ProgressSet($Percent, $Percent & " Percent Complete") Next ProgressSet(100, "Done", "Complete") Sleep(1000) ProgressOff()
And modified the END OF REPORT to match the string I am looking for but can't figure out how to make it split right before that line. That code makes files like this
File 1:
COMPANY NAME etc
File 2 and so forth:
ADDRESS
** REST OF PAGE **
COMPANY NAME
Your help is appreciated.