This one was so obvious that I overlooked it. In the case I'm not the only one: here you go ...
Best illustrated with an example.
For a .btm script to resize/reposition the current TCC window, I had to calculate the visible number of rows and columns in the current window. That can be done like this:
set VISIBLE_WIDTH=%@eval[%@word[",",1,%@winclientsize[=%_pid]] / %@font[1]]
Never mind this specific command. The formula itself isn't important.
As this had to do be done multiple times, it became (eventually :-):
set _VISIBLE_WIDTH=%%@eval[%%@word[",",1,%%@winclientsize[=%%_pid]] / %%@font[1]]
The important difference: %'s are converted to %%.
Now you can echo %_VISIBLE_WIDTH and and it will be calculated "just in time".
That can be illustrated with the command SET _VISIBLE_WIDTH
It gives you the "formula" and not the "answer".
Another example, now with an external program (from the same btm)
You can get the current screen buffer size with something like:
mode con | ffind /km /t"Columns" | echo %@trim[ %@word[":",1,%@line[con,0]] ]
Again, the formula itself isn't that important.
Turned into an "internal variable":
set _BUFFER_WIDTH=%%@execstr[( mode con ^| ffind /km /t"Columns" ^| echo %%@trim[ %%@word[":",1,%%@line[con,0]] ] )]
Best illustrated with an example.
For a .btm script to resize/reposition the current TCC window, I had to calculate the visible number of rows and columns in the current window. That can be done like this:
set VISIBLE_WIDTH=%@eval[%@word[",",1,%@winclientsize[=%_pid]] / %@font[1]]
Never mind this specific command. The formula itself isn't important.
As this had to do be done multiple times, it became (eventually :-):
set _VISIBLE_WIDTH=%%@eval[%%@word[",",1,%%@winclientsize[=%%_pid]] / %%@font[1]]
The important difference: %'s are converted to %%.
Now you can echo %_VISIBLE_WIDTH and and it will be calculated "just in time".
That can be illustrated with the command SET _VISIBLE_WIDTH
It gives you the "formula" and not the "answer".
Another example, now with an external program (from the same btm)
You can get the current screen buffer size with something like:
mode con | ffind /km /t"Columns" | echo %@trim[ %@word[":",1,%@line[con,0]] ]
Again, the formula itself isn't that important.
Turned into an "internal variable":
set _BUFFER_WIDTH=%%@execstr[( mode con ^| ffind /km /t"Columns" ^| echo %%@trim[ %%@word[":",1,%%@line[con,0]] ] )]
Last edited: