Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@select inside alias gives different (insanely small) window

Jun
14
0
TCC 26.02.42 x64 Windows 10 [Version 10.0.19041.630]

I'm trying to see if I can upgrade my ancient 4NT to TCC. In 4NT, I had the following alias:
@alias gd `set gd_sel=%@select[%[DATRLB]\4nt\gd.txt, 1, 1, 20, 80, 'gd: Goto Directory'] &^ iff "%[gd_sel]" != "" then &^ iff isdir %@word[1,%[gd_sel]] then &^ cdd %@word[1,%[gd_sel]] &^ else &^ echo "That directory doesn't exist! (%[gd_sel])" &^ endiff &^ else &^ echo "OK, no selection. (%[gd_sel])" &^ endiff &^ `
(DATRLB is just a directory prefix). In TCC, this produces a tiny window with absurdly small text:

foo.png


However, if I cut and paste the first line in the alias into my console, it produces an @SELECT window of normal size. Likewise, if I make that cut and paste into an alias, it still seems to work fine, making it hard to create a more minimal example. I can't see any relevant changes in any of the command I'm using. I'm stuck. Any ideas where to look for the problem?

Making a selection in the tiny window also produces the text "The process ID is nnnn" (where nnnn is a presumably real process ID). So maybe I've gotten something really messed up when trying to just drop TCC in as a 4NT replacement.
 
Hmmm, well, docs say TCC switches behavior depending on whether width is >= 150; that seems to be true interactively at least.

@SELECT TCC internal variable function
If the specified width is < 150, the top, left, bottom, right parameters are assumed to be rows/columns relative to the TCC window. If the width is >= 150, the parameters are assumed to be screen coordinates (in pixels).
Do I misunderstand the help file?
 
Through tedious binary search, it appears that tcc, unlike 4nt, does not like the space after the final endiff. If I change this:
Code:
endiff &^
to this:
Code:
endiff&^
then the select window is normal, no message about a process ID, etc. Wonder what's really going on there?
Here's a simple alias that I guess spawns another process for reasons I can't grasp:
Code:
@alias bug1 `&^
iff "1" == "1" then &^
    echo one with everything &^
endiff &^
`
But if you remove the space after the endiff, it behaves normally.
 
Just typing endiff & followed by Enter produces a message like "The process ID is nnnn". Or, I guess you can substitute any command for the endiff and get the same result.
 
Just typing endiff & followed by Enter produces a message like "The process ID is nnnn". Or, I guess you can substitute any command for the endiff and get the same result.
Documented but obscure feature; the trailing ampersand is an alternative (Linuxy) way of doing a DETACH.

I'm not sure it should work with ENDIFF, though. Seeing as how ENDIFF is not actually a command.
 
Documented but obscure feature; the trailing ampersand is an alternative (Linuxy) way of doing a DETACH.

I'm not sure it should work with ENDIFF, though. Seeing as how ENDIFF is not actually a command.
Thanks, one mystery solved. I assume you're referring to the one-line note in the help file entry for DETACH? The space required before the ampersand (for DETACH, but not for separating commands!) remains undocumented, unless its lurking somewhere else.

I can't tell if the documentation saying the pseudovariable %+ "is deprecated as of Take Command v17, and most support has been removed in v20" applies to TCC. If that can't be relied on, then I guess writing robust batch files requires being aware of the obscure rules for parsing of & and hoping nobody changes the command separator outside the batch file.
 
And the unusable tiny select window can be produced as simply as:
Code:
echo foo >foo.txt
%@select[foo.txt, 1, 1, 20, 80, 'bugg'] &
Removing the trailing space-ampersand produces the correct size selection window.

Possibly it should refuse to run rather than go bonkers in this situation.
 
Back
Top
[FOX] Ultimate Translator
Translate