2
So let's say want to select some text with the mouse or keyboard and then manipulate it using a Python function. I will explain what I have been doing and what the problem with that is.
Current approach: 1) store the previous contents of the clipboard in a temporary variable, 2) copy the selected text into the clipboard, 3) pass the copied selected text into a Python function via Pyperclip, 4) and then put the original clipboard content back on the clipboard (using the temporary variable).
Problem with current approach: even though it does not affect what is on the first slot on the clipboard, it does put extraneous content (namely the selected text) onto the second slot of the multi-clipboard. Is there a way to instead put the selected text onto e.g. the 100th slot on the multi-clipboard? Another potentially good option would be to just delete the extraneous content from the multi-clipboard once it is passed into the Python function; is there a way to delete content on the Windows multi-clipboard using a Python function? (I know you can do that using the GUI.) Alternatively, if there is a way to read selected text into a Python function without ever putting it on any slot of the multi-clipboard that would work too.
Background: Windows recently introduced a native multi-clipboard which can be accessed by pressing Windows-v (see here), and there are third-party apps such as Ditto which provide a multi-clipboard. A solution that uses the Windows multi-clipboard rather than a third-party application would be preferable but not essential.
A method of pasting text from a Python function into the active field without altering the clipboard would also be of interest.
Thanks
1
Super User is for computer hardware & software enthusiasts and power users. Stack Overflow is for programmers. Since, you want to ask questions about code, you want to ask this on SO. Welcome! See: https://meta.superuser.com/questions/4836/what-is-the-difference-between-super-user-and-stack-overflow
– kennyB – 2019-06-01T12:43:50.1201
It would also be helpful to try and outline at least some of what you're trying to do in code, to the extent that it's feasible. The ideal question tries to make an MRE.
– kennyB – 2019-06-01T12:46:41.377