(10-26-2024, 09:42 PM)SMcNeill Wrote: Change line 26 to:
If _TRME$(o$) <> "" _OrElse temp$ = "" Then Print #1, o$
That should get rid of those blank lines for you, while preserving blank lines which existed originally in your code between SUBS or whatever.
(10-27-2024, 12:49 PM)Dimster Wrote: Steve - I make the change to line 26 as you suggested but now getting an invalid name error on that line. I believe the old line 26 simply read "Print #2, o$". Is that correct?
Pete - not sure what I'm doing wrong but seems I'm constantly getting "File Not Found". Something seems to be off with path?
Invalid name is correct, as I can't type on the iPad worth a hoot at 2am.
![Tongue Tongue](https://qb64phoenix.com/forum/images/smilies/tongue.png)
Try this:
If _TRIM$(o$) <> "" _OrElse temp$ = "" Then Print #2, o$
Whole version with the change to completely eliminate those extra lines for you:
Code: (Select All)
Do
BasIn$ = _OpenFileDialog$("File to Remove Comments From", "", "*.bas|*.bi|*.bm", "QB64PE files", 0)
If BasIn$ <> "" Then
period = _InStrRev(BasIn$, ".")
BasOut$ = Left$(BasIn$, period - 1) + " (No Rem)" + Mid$(BasIn$, period)
Open BasIn$ For Binary As #1
Open BasOut$ For Output As #2
Do Until EOF(1)
Line Input #1, temp$
in_quote = 0
For p = 1 To Len(temp$)
m$ = Mid$(temp$, p, 1)
Select Case m$
Case Chr$(34) 'quote
in_quote = Not in_quote
Case "'" 'Remark character
If Not in_quote Then 'remark found
If p = 1 _Andalso Mid$(temp$, 2, 1) = "$" Then p = Len(temp$) + 1 'it's a metacommand
Exit For
End If
Case "$"
If p = 1 Then p = Len(temp$) + 1 'it's a metacommand
End Select
Next
o$ = Left$(temp$, p - 1)
If _Trim$(o$) <> "" _Orelse temp$ = "" Then Print #2, o$
Loop
Else System
End If
Loop