04-06-2024, 06:00 PM
i just tested lprint for making hardcopies of some code files. not bad
i added line numbers so you can see which lines are carry over from previous lines and which are the start of new program line
i tested the code below first for quick half page copy then I did an 842 line program [editor] i am working on and it handled multiple pages without skipping a beat in about 16 pages.
maybe you will find it handy or handy to mod for your purposes
i added line numbers so you can see which lines are carry over from previous lines and which are the start of new program line
i tested the code below first for quick half page copy then I did an 842 line program [editor] i am working on and it handled multiple pages without skipping a beat in about 16 pages.
maybe you will find it handy or handy to mod for your purposes
Code: (Select All)
_Title "print file" 'b+ 2024-04-06
pfile$ = _OpenFileDialog$("Select file to print", _CWD$, "*.bas|*.txt", "text files", 0)
If pfile$ <> "" Then
t$ = _ReadFile$(pfile$)
ReDim f$(1 To 1)
Split t$, Chr$(13) + Chr$(10), f$()
For i = LBound(f$) To UBound(f$)
LPrint i; " "; f$(i)
Next
Print "All done."
End If
' note: I buggered this twice now, FOR base 1 array REDIM MyArray (1 to 1) AS ... the (1 to 1) is not same as (1) which was the Blunder!!!
'notes: REDIM the array(0) to be loaded before calling Split '<<<< IMPORTANT dynamic array and empty, can use any lbound though
'This SUB will take a given N delimited string, and delimiter$ and create an array of N+1 strings using the LBOUND of the given dynamic array to load.
'notes: the loadMeArray() needs to be dynamic string array and will not change the LBOUND of the array it is given. rev 2019-08-27
Sub Split (SplitMeString As String, delim As String, loadMeArray() As String)
Dim curpos As Long, arrpos As Long, LD As Long, dpos As Long 'fix use the Lbound the array already has
curpos = 1: arrpos = LBound(loadMeArray): LD = Len(delim)
dpos = InStr(curpos, SplitMeString, delim)
Do Until dpos = 0
loadMeArray(arrpos) = Mid$(SplitMeString, curpos, dpos - curpos)
arrpos = arrpos + 1
If arrpos > UBound(loadMeArray) Then ReDim _Preserve loadMeArray(LBound(loadMeArray) To UBound(loadMeArray) + 1000) As String
curpos = dpos + LD
dpos = InStr(curpos, SplitMeString, delim)
Loop
loadMeArray(arrpos) = Mid$(SplitMeString, curpos)
ReDim _Preserve loadMeArray(LBound(loadMeArray) To arrpos) As String 'get the ubound correct
End Sub
b = b + ...