%_selected no longer working

Jun 2, 2008
376
2
Newton, MA
I have a number of buttons that rely on %_selected to pass along the text that is selected in the TCMD window. It is no longer working.

upload_2015-12-28_14-43-40.png


After selecting "echo" and pressing the Enter key, I get this:

upload_2015-12-28_14-44-13.png
 
Jun 2, 2008
376
2
Newton, MA
The test above does not work in TCMD17 either, so it is apparently not a proper test. Here is the real problem.

I have a toolbar button called EREN with the following command specification:

esc "eren %%@quote[%_selected]" enter​

With the screen looking like this

upload_2015-12-28_15-3-35.png


I click on the EREN button and get the following:

upload_2015-12-28_15-4-15.png


In TCMD17, the button works fine and I get the following:

upload_2015-12-28_15-7-51.png
 
May 20, 2008
11,411
99
Syracuse, NY, USA
It somehow has something to do with what was recently done. This is strange!

I have a button, "test", which sends the following to the current tab.
Code:
esc "echo %%@quote[%_selected]" enter
The attached batch file should work for anyone, and produce a list of the temperatures in Syracuse, NY for each of the last 24 hours plus the average. There's nothing peculiar in it. Run it, then select one line of its output, the button will fail as Jay described. After that the button will work as expected. Run the BTM again and the button will fail (again only once).
Here's the result of running the BTM, selecting its last output line and pressing the button ... then selecting the same line and pressing the button again.
Code:
v:\> 123.btm
15:54  28
14:54  28
13:54  27
12:54  26
11:54  26
10:54  26
09:54  25
08:54  24
07:54  24
06:54  27
05:54  30
04:54  30
03:54  32
02:54  33
01:54  32
00:54  33
23:54  33
22:54  33
21:54  33
20:54  34
19:54  35
18:54  35
17:54  35
16:54  35

Average: 30.17

v:\> echo %@quote[]
ECHO is OFF

v:\> echo %@quote[Average: 30.17]
"Average: 30.17"
 

Attachments

  • 123.btm
    477 bytes · Views: 72
Jun 2, 2008
376
2
Newton, MA
Vince,

I'm glad you were able to reproduce the problem. I was beginning to think I was losing my mind.

I just installed TCMD19 on another computer, and it was working fine there. On my main computer, I could not get it to recover until I rebooted. Now %_selected is working again. I'll have to watch and try to determine what I did to make it stop.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
I was using v19 all along. And the behavior is as I described with v17 and v18, but not with v16 (i.e., it worked correctly with v16). Jay, did you try to reproduce my experiment?
 
May 20, 2008
11,411
99
Syracuse, NY, USA
I've whittled down the BTM even further.
Code:
copy /q "http://w1.weather.gov/data/obhistory/KSYR.html" %TEMP\ksyr.tmp

setarray /F l[24]

echo %@execarray[l,tpipe /input=%TEMP\ksyr.tmp ^
   /grep=3,0,0,1,0,0,0,0,"right.*left" ^
   /replace=4,1,0,1,0,0,0,0,0,".*([0-9][0-9]:[0-9][0-9]).*td.(-*[0-9]*)..td..td.*[0-9]*..td.$","$1  $2" ^
   /head=0,0,24]
The results are the same after running the BTM, and (twice) selecting the previous command line (v:\> 123.btm) and pressing my "test" toolbar button.
Code:
v:\> 123.btm
0

v:\> echo %@quote[]
ECHO is OFF

v:\> echo %@quote[v:\> 123.btm]
"v:\> 123.btm"
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
The test above does not work in TCMD17 either, so it is apparently not a proper test. Here is the real problem.

I have a toolbar button called EREN with the following command specification:

esc "eren %%@quote[%_selected]" enter​

Not reproducible here -- I tried it a couple dozen times & it always worked.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
Here's a very simple one that shows a problem here. Make a button ("test") that sends this to the current tab:
Code:
esc "echo %%@quote[%_selected]" enter
Execute this command:
Code:
echo abc def | tpipe /grep=3,0,0,1,0,0,0,0,"ab"
Now select the just-echoed "abc def" and press the "test" button.
Select the same text again and press "test" again.
Here's what I see:
Code:
v:\> echo abc def | tpipe /grep=3,0,0,1,0,0,0,0,"ab"
abc def

v:\> echo %@quote[]
ECHO is OFF

v:\> echo %@quote[abc def]
"abc def"
 
Last edited:
Jun 2, 2008
376
2
Newton, MA
Vince's test reproduces as described for me:

upload_2015-12-28_22-17-33.png


In fact, I can do it more than once.
 
Jun 2, 2008
376
2
Newton, MA
It may be a problem related to piping. The same thing happens with the command lines

echo abc def | type
echo abc def | view​

Now, when this first happened to me, %_selected stopped working permanently, and only a reboot restored proper operation. So I must have done something else. I don't think that I am using piping in my aliases or scripts, and I certainly did not do it manually.
 
May 20, 2008
11,411
99
Syracuse, NY, USA
It may be a problem related to piping.
Yes, indeed ... and only piping to internals. There's no problem piping to GREP.EXE or SORT.EXE, but the problem shows up with either of these:
Code:
echo abc def | ffind /t"ab"
echo abc def | do x in @CON: ( echo %x )
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
The %_selected expansion occurs inside TCMD, not TCC. TCMD is trying for a PID match on the console session, but the child pipe process breaks that when it does some IPC with TCMD and then disappears. If the parent TCC process then does some IPC, things get reset; otherwise TCMD doesn't know who's talking to it.

This is exactly the same behavior in every version of TCMD / TCC; the only difference will be in the timing of the IPC.

I might be able to work around it by forcing a dummy IPC after the child pipe process exits.
 
Jun 2, 2008
376
2
Newton, MA
I'm back in the state where %_selected will not work at all, even after shutting down TCMD and starting it up again (even killing SHRALIAS, in case that had anything to do with it). I am unable to get things working except by rebooting the computer, which is a huge nuisance.

Unfortunately, I don't know what I did that may have precipitated the problem. Maybe I should turn on command logging so I can go back and look.
 
Jun 2, 2008
376
2
Newton, MA
Well, I did turn on logging, and the problem did come back. I was logging only commands, not everything, but the variable returned a value in one command and failed in the next command. So it would appear that something I was doing outside of TCMD may have caused the problem to appear (though that seems to me hard to imagine). Now I'll try turning on logging of all activity (after rebooting) and see if something else was going on that did not get logged.
 
Jun 2, 2008
376
2
Newton, MA
Ugh. I tried it once more before rebooting, and now it's working again! I wonder if perhaps the text that I had selected became unselected without my noticing.

I'm now having trouble with the LOG command. A new LOG command with different options is not superseding the previous command, and the log file does not contain the date stamp described in the help file. I'm going to reboot and start over.
 
Similar threads
Thread starter Title Forum Replies Date
B Why Does @GETDIR Repeat Selected Directory Name In Returned Value Support 7
Jay Sage Function to Return Selected Text Support 2
D Alias with setdos no longer works Support 21
nickles ANSI Colors Windows 7 no longer working Support 6
P Escape key no longer clears command line in v24 Support 21
D Shift+Enter no longer acts like "Enter" in TCC 24 Support 2
F Update 21.00.34 -> 37, key no longer recognised Support 2
M Is STDVCL40.DLL missing or no longer needed? Support 4
P Fixed Rexx .cmd files no longer work in TCC 20 Support 3
mdwyer TCC 13 COPY: specified network name is no longer available. Support 5
Detlef Fixed ParameterChar in TCMD.INI no longer working Support 35
M TCC no longer runs after installing TC 17 Support 22
R Drag to BTM no longer works in Windows 8.1 Support 10
J NT 8.0.102 purchased version is not longer "registered" since installing trial of TCMD 15. Support 10
R Fixed cd \ut<tab> does no longer work? Support 1
M Oldver Link in no longer accessible Support 1
H Escape key no longer closes Help Support 3
R key aliases no longer working Support 2
K Ctrl-D alias no longer works Support 4
J TCC v11 No longer portable Support 2
mscheuner TakeCommand no longer showing its icon in Win7 Taskbar Support 12
L TCC/TCMD 11 Build 38 does no longer work ... Support 11
twaterloo FolderMonitor for the 1st time not working Support 5
Tim Rowe NTFS Descriptions not working Support 13
J Batcomp still not working for me in TCMD27 Support 1
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
M Why did BEEP just quit working? Support 12
cgunhouse SETLOCAL not working in BDEBUGGER Support 9
K ANSI Not Working Support 8
thorntonpg option /u not working The directory name is invalid Support 5
Charles Dye Is the "File Associations" installer dialog working? Support 4
H @ceiling @floor @int not working version 21.01.63 Support 9
K Command Line Selection Not Working Support 12
G Extended directory search not working Support 4
B %@fileseek is not working ? Support 2
C "Take Command has stopped working" Support 1
H New command not working well in Windows 7 Support 4
C "TakeCommand has stopped working" Support 3
N ping DNS lookup not working Support 1
N Updater/silentall not working? Support 1
K Help Not Working Support 11
R Fixed set /r has stopped working in build 35 Support 4
U Keys and IDX not working Support 11
Jesse Heines How to? Everything Tool Not Working After Version 20 Installation Support 8
WavSlave Fixed LIST /U not working in TCC v19 Support 5
S iftp copying pgp files from ftp is not working Support 11
fishman@panix.com Extended Directory Searches are not working for me in CDD Support 9
J How to set working directory Support 10
vefatica Fixed LEAVE N not working Support 7
P %date5 not working Support 6

Similar threads