- Aug
- 2,828
- 147
I have been using the following to find comments in .btm files;
However, this neglects comments that do not appear at the beginning of a line.
No biggie, it still gives me the gist of the comments.
A recent conversation has encouraged me to try and find comments that not only appear at the beginning of a line,
but that begin in iff structures and such.
As Regular Expressions and I are not friends,
even after reviewing Beginning Regular Expressions
I gave in and asked DuckAI for assistance.
Link to DuckAI conversation: Shared Duck.ai Chat
(the link expires 30 days from now).
Thus, I have updated my Comments.btm script;
Output;
I re-visted this due to the new LINES command in the FileUtils plugin,
which shows the number of comment lines in a .btm file.
FileUtils plugin: FileUtils Plugin
Joe
Code:
R:\>ffind /kvm /e"^( {0}::| {0}REM )") r:\zoom150.btm
:: File: zoom150.btm
:: Created: 2024-07-19
:: _4ver: 32.10
:: _winver: 10.0
::echo %_startpid
::activate "New tab*"
:: Changed to 13 (was 15) on 2024-07-21
:: Changed to 16 (was 13) on 2024-10-20
However, this neglects comments that do not appear at the beginning of a line.
No biggie, it still gives me the gist of the comments.
A recent conversation has encouraged me to try and find comments that not only appear at the beginning of a line,
but that begin in iff structures and such.
As Regular Expressions and I are not friends,
even after reviewing Beginning Regular Expressions
I gave in and asked DuckAI for assistance.
Link to DuckAI conversation: Shared Duck.ai Chat
(the link expires 30 days from now).
Thus, I have updated my Comments.btm script;
Code:
@SETLOCAL
@ECHO OFF
if isdir r:\temp set temp=r:\temp
iff %# eq 0 then
echo USAGE: %_batchname theFile.btm
quit
endiff
set theFile=%1
iff exist %theFile then
ffind /kvm /e"^[ \t]*(::|REM )" %theFile
ffind /kvm /e"^[ \t]*(::|REM )" %theFile > tmp9:
echo ^nNumber of comment lines: %@inc[%@lines[tmp9:]]
else
echo %theFile does not exist.
endiff
:eoj
ENDLOCAL
Output;
Code:
R:\>comments r:\zoom150.btm
:: File: zoom150.btm
:: Created: 2024-07-19
:: _4ver: 32.10
:: _winver: 10.0
:: NEXT SENTENCE
::echo %_startpid
::activate "New tab*"
:: Changed to 13 (was 15) on 2024-07-21
:: Changed to 16 (was 13) on 2024-10-20
Number of comment lines: 9
I re-visted this due to the new LINES command in the FileUtils plugin,
which shows the number of comment lines in a .btm file.
FileUtils plugin: FileUtils Plugin
Joe
Last edited: