Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove Remarks for Programs
#17
(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

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
Reply


Messages In This Thread
Remove Remarks for Programs - by Pete - 10-26-2024, 02:01 AM
RE: Remline clone for QB64. - by ahenry3068 - 10-26-2024, 03:33 AM
RE: Remline clone for QB64. - by ahenry3068 - 10-26-2024, 03:51 AM
RE: Remline clone for QB64. - by Pete - 10-26-2024, 04:02 AM
RE: Remline clone for QB64. - by ahenry3068 - 10-26-2024, 07:25 AM
RE: Remove Remarks for Programs - by SMcNeill - 10-26-2024, 08:16 AM
RE: Remove Remarks for Programs - by PhilOfPerth - 10-26-2024, 09:50 AM
RE: Remove Remarks for Programs - by Dimster - 10-26-2024, 01:14 PM
RE: Remove Remarks for Programs - by Dimster - 10-26-2024, 02:01 PM
RE: Remove Remarks for Programs - by SMcNeill - 10-26-2024, 09:42 PM
RE: Remove Remarks for Programs - by Pete - 10-26-2024, 10:31 PM
RE: Remove Remarks for Programs - by SMcNeill - 10-26-2024, 10:47 PM
RE: Remove Remarks for Programs - by Pete - 10-26-2024, 11:03 PM
RE: Remove Remarks for Programs - by PhilOfPerth - 10-26-2024, 11:26 PM
RE: Remove Remarks for Programs - by Pete - 10-26-2024, 11:29 PM
RE: Remove Remarks for Programs - by Dimster - 10-27-2024, 12:49 PM
RE: Remove Remarks for Programs - by SMcNeill - 10-27-2024, 01:04 PM
RE: Remove Remarks for Programs - by Dimster - 10-27-2024, 02:22 PM



Users browsing this thread: 1 Guest(s)