Welcome!

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

SignUp Now!

Copying Duplicate Text to the Clipboard

Jun
1,092
48
I was caught off guard and surprised when testing a script that calculated some text and copied it to the clipboard. If I ran the command again, the text was not being copied. In addition, when the script was called from another script, control did not return (at least sometimes) to the calling script. Execution terminated as if the second script had been chained to rather than called.

So far, I have been unable to find a completely consistent pattern for this, and I'm hoping that someone can explain it. A few things things seem to repeat consistently.
  1. If I run something like echo test > clip: for the first time, the text is copied to the clipboard. If I recall it from the history and run it again and again, the text is never copied again. It also is not copied if I retype the same command. I can also modify the command line in an insignificant way, such as removing the space between '>' and 'clip:' or adding extra space, and still nothing is copied to the clipboard.

  2. If I run the command echo test | clip under CMD in Windows Terminal, the text is copied, even if I do it right after sending the same text to the clipboard from TCC. Repeating the command does not result in anything being copied to the clipboard. If I return to TCC and recall the command, text is copied the first time, but not thereafter.
 
In 1. what does "is never copied again" mean. Are you saying it's no longer in the clipboard?
 
No, it does not disappear from the clipboard. It simply is not copied again. If I switch from TCC to CMD, the text is copied twice.

Hmmm. I was going to show you by running type clip:. To my surprise, it shows only a single copy of the copied text, while my CLIPX program, which keeps a clipboard history (and does some other nifty stuff) shows two copies. It issues a sound every time it records a new entry to the clipboard, and that's what I'm not hearing when I repeat the commands. That's what told me that the copy was not happening. Now I realize that just looking at the clipboard would not see two copies in any case, since the new entry would overwrite the old (identical) one.

I just tried using echo test >> clip: instead, and I do not see the same behavior. The string is copied every time, and the lines accumulate in the clipboard. So the problem I was seeing was caused by CLIPX. It clearly has to intercept material going to the clipboard, and it is not sending it or not storing it under some circumstances.

Maybe this is a bug in CLIPX, and I should report it to them.

I tried shutting down CLIPX, but then I could not tell whether the command was storing the text of not. What I have to do, perhaps, is change how I have the CLIP: pseudo-devices configured. I never wanted to use them the way Rex intended, so I turned off the automatic stack operation. Now that we have the TMP: pseudo-devices, the CLIP: devices can be used in the original way. Then I might be able to tell if material is being sent to the clipboard.

Well, I have that INI setting, but I cannot find it, so my clip#: devices do not rotate, and I cannot do that experiment. Can you find that setting?
 
What does it mean to be in the clipboard twice. Do you know the Windows multi-clipboard (Win+V). That may just be how it works. Evan copying the same thing twice (in a row) with an editor ... it only shows up once.

1784589693294.webp
 
This is what I see in the CLIPX window after copying the string once from TCC and once from CMD.

1784592108023.webp


It is listed as the most recent clipboard entry (1) and the previous entry (2). I've got 50 clipboard entries there plus a dozen or so saved snippets for repeated use.
 
Back
Top