I am a teacher using Windows and would like to be able to paste short program snippets one after another from a file of examples I have into whatever programming environment I am teaching (e.g. the python IDLE shell or editor). During the lecture I would have IDLE open and then use Ctrl-v to paste line 1 from the file into IDLE, execute & discuss it, then use Ctrl-v to paste line 2 from the file into IDLE, execute & discuss it, then use Ctrl-V to get line 3 into IDLE, and so on ...
I suspect there is some way to do this with a clipboard manager, but haven't found it online.
Being able to paste sections of code instead of just single lines would be really useful as well. The sections of code in the file could be separated by a blank line or some kind of text string indicator.
Having this functionality would allow me to have all my examples ready in a file and then during the lecture have quick access to all the examples one at a time by using Ctrl-v.
Unfortunately, I cannot comment, but the great solution by @Patrick only works for me when I add a
sleep
command - otherwise, the clipboard content gets overwritten before the line is pasted. So if you run into a similar issue, the following version might do it: