- Aug
- 2,831
- 149
This is just a proof of concept,
to see if it could be accomplished,
and how it would be accomplished.
Here is the process that I used to comment a TCC .btm
First, the prompt for Microsoft CoPilot;
I then added the following to the top of my TCC code,
which Microsoft CoPilot helped me create;
I then asked Microsoft CoPilot to comment the TCC code,
and it added the very verbose comments as follows;
Joe
to see if it could be accomplished,
and how it would be accomplished.
Here is the process that I used to comment a TCC .btm
First, the prompt for Microsoft CoPilot;
Context: Take Command Console (TCC) version 35 only.
Authority:
- jpsoft.com help pages are the ONLY authoritative documentation for TCC v35.
- If a command/function/switch is not explicitly documented on jpsoft.com, treat it as NON-EXISTENT.
Hard requirements:
1) Before recommending any TCC feature (command, variable function, plugin function, switch, syntax), you MUST cite the exact jpsoft.com help page that documents it.
2) If you cannot cite a jpsoft.com page for a feature, do not mention it as an option—say “not documented; treated as non-existent.”
3) Confidence scoring: any claim without a jpsoft.com citation must be scored 0.00 and omitted from recommendations.
4) When uncertain, ask a clarifying question or request the relevant jpsoft.com page/link from me.
Process:
- Break complex problems into smaller pieces.
- Check answers from multiple perspectives.
- Reflect and fix weak reasoning.
- Only commit when confidence is high.
Comment this TCC script using my standard plugin‑resolution header block.
I then added the following to the top of my TCC code,
which Microsoft CoPilot helped me create;
Code:
:: ============================================================================
:: Symbol Resolution Audit
::
:: Environment:
:: Take Command Console v35
:: ISO8601.dll loaded
::
:: ISO8601 Plugin Symbols Used:
:: @DatePlus[] (plugin-only)
:: https://charlesdye.net/plugins/iso8601.html#f_dateplus
::
:: @DOWI[] (plugin override)
:: Plugin: https://charlesdye.net/plugins/iso8601.html#f_dowi
:: Native: https://jpsoft.com/help/dowi.htm
::
:: @MakeAge[] (plugin override)
:: Plugin: https://charlesdye.net/plugins/iso8601.html#f_makeage
:: Native: https://jpsoft.com/help/makeage.htm
::
:: Native TCC Symbols Used:
:: @Replace[] https://jpsoft.com/help/replace.htm
:: @FormatN[] https://jpsoft.com/help/formatn.htm
:: @Eval[] https://jpsoft.com/help/eval.htm
::
:: Non-Existence Rule:
:: Any symbol not documented above is treated as non-existent.
:: ============================================================================
I then asked Microsoft CoPilot to comment the TCC code,
and it added the very verbose comments as follows;
Code:
@SETLOCAL
@ECHO OFF
:: ============================================================================
:: Symbol Resolution Audit
::
:: Environment:
:: Take Command Console v35
:: ISO8601.dll loaded
::
:: ISO8601 Plugin Symbols Used:
:: @DatePlus[] (plugin-only)
:: https://charlesdye.net/plugins/iso8601.html#f_dateplus
::
:: @DOWI[] (plugin override)
:: Plugin: https://charlesdye.net/plugins/iso8601.html#f_dowi
:: Native: https://jpsoft.com/help/dowi.htm
::
:: @MakeAge[] (plugin override)
:: Plugin: https://charlesdye.net/plugins/iso8601.html#f_makeage
:: Native: https://jpsoft.com/help/makeage.htm
::
:: Native TCC Symbols Used:
:: @Replace[] https://jpsoft.com/help/replace.htm
:: @FormatN[] https://jpsoft.com/help/formatn.htm
:: @Eval[] https://jpsoft.com/help/eval.htm
::
:: Non-Existence Rule:
:: Any symbol not documented above is treated as non-existent.
:: ============================================================================
comment
:: Diagnostic block confirming:
:: - q.exe is an external SQL‑like CSV/DBF query tool
:: - bp.dbf schema matches bp.csv
:: - ISO8601 plugin is loaded and @DatePlus[] resolves to plugin
::
:: No TCC symbols are introduced here; this is informational only.
endcomment
comment
This comment block was placed here by the code author (me)
Microsoft CoPilot had originally removed this comment block,
and replaced it with the preceeding comment block.
E:\...\bp>which q.exe
q.exe is an external : C:\Program Files\q-text-as-data\q.exe
See https://github.com/harelba/q for more details.
CSV file has same structure as DBF
Filename: bp.dbf
Type: dBase III without memo file
Memo File: False
Records: 227
Fields:
Name Type Length Decimal
------------------------------------------------------------------------------
THEDATE C 8 0
THETIME C 4 0
SYS N 3 0
DIA N 3 0
PULSE N 3 0
E:\...\bp>which @dateplus
@dateplus is a plugin variable (ISO8601)
Help for @dateplus is at https://charlesdye.net/plugins/iso8601.html#f_dateplus
endcomment
:: Ensure ISO8601 plugin is loaded
:: PLUGIN command is native TCC
:: https://jpsoft.com/help/plugin.htm
if not plugin ISO8601 plugin /l e:\utils\iso8601.dll
:: ---------------------------------------------------------------------------
:: Determine most recent completed Sunday‑based week
::
:: %_isodate is a native TCC internal variable
:: https://jpsoft.com/help/isodate.htm
::
:: @DatePlus[] subtracts one day to avoid partial current week
:: ---------------------------------------------------------------------------
set qStartDate=%@DatePlus[%_isodate -1]
:: Walk backward until Day‑Of‑Week‑ISO == 1 (Sunday)
:: @DOWI[] returns ISO weekday number
do while %@dowi[%qStartDate] ne 1
set qStartDate=%@DatePlus[%qStartDate -1]
enddo
:: End date is Saturday (Sunday + 6)
set qEndDate=%@DatePlus[%qStartDate +6]
:: Convert ISO yyyy‑mm‑dd → yyyymmdd for CSV string comparison
:: @Replace[] removes hyphens
set cStartDate=%@replace[-,,%qStartDate]
set cEndDate=%@replace[-,,%qEndDate]
:: ---------------------------------------------------------------------------
:: Report header
:: ---------------------------------------------------------------------------
echo Weekly Blood Pressure Log for Joseph Caverly
echos Printed:` `
echo %_isodate
echo.
echo.
echo Starting SYS Avg DIA Avg Pulse Avg
:: ---------------------------------------------------------------------------
:: Iterate backward week‑by‑week until oldest record date
::
:: @MakeAge[] compares dates by age in days
:: Loop continues while start date is newer than 2024‑01‑08
:: ---------------------------------------------------------------------------
do while %@makeage[%qStartDate] gt %@makeage[2024-01-08]
:: Recompute CSV‑formatted dates for this week
set cStartDate=%@replace[-,,%qStartDate]
set cEndDate=%@replace[-,,%qEndDate]
:: SQL WHERE clause reused for record existence test
set theQuery="Select * from bp.csv where thedate BETWEEN '%cStartDate' and '%cEndDate'"
:: Count records for this week using q.exe
:: %{ } executes external command and captures output
:: https://jpsoft.com/help/command_substitution.htm
set TotalRecords=%{1,q.exe -H -d, -b -O -T -C read "SELECT COUNT(*) FROM bp.csv WHERE thedate BETWEEN '%cStartDate' AND '%cEndDate'"}
:: Only emit output if data exists
iff %TotalRecords gt 0 then
Gosub Details
endiff
:: Move to previous week
set qStartDate=%@DatePlus[%qStartDate -7]
set qEndDate=%@DatePlus[%qEndDate -7]
enddo
ENDLOCAL
quit
:: ============================================================================
:: Details subroutine
::
:: Computes weekly averages for SYS, DIA, and PULSE
:: ============================================================================
:Details
:: Recount records defensively
set TotalRecords=%{1,q.exe -H -d, -b -O -T "SELECT COUNT(*) FROM bp.csv WHERE thedate BETWEEN '%cStartDate' AND '%cEndDate'"}
:: Aggregate sums
set TotalSys=%{1,q.exe -H -d, -b -O -T -C read "SELECT SUM(sys) FROM bp.csv WHERE thedate BETWEEN '%cStartDate' AND '%cEndDate'"}
set TotalDIA=%{1,q.exe -H -d, -b -O -T -C read "SELECT SUM(DIA) FROM bp.csv WHERE thedate BETWEEN '%cStartDate' AND '%cEndDate'"}
set TotalPulse=%{1,q.exe -H -d, -b -O -T -C read "SELECT SUM(PULSE) FROM bp.csv WHERE thedate BETWEEN '%cStartDate' AND '%cEndDate'"}
:: Output:
:: - Date
:: - SYS average (integer)
:: - DIA average (integer)
:: - Pulse average (integer)
::
:: @Eval[] performs arithmetic
:: @FormatN[] formats numeric width and precision
echos %qStartDate` `
echos %@formatn[6.0,%@eval[%TotalSys / %TotalRecords]]` `
echos %@formatn[5.0,%@eval[%TotalDIA / %TotalRecords]]` `
echo %@formatn[2.0,%@eval[%TotalPulse / %TotalRecords]]
Return
Joe