Reputation: 17234
First of all, its a windows question. Let me introduce you to the linux counterpart.
In Linux, when I select a text anywhere in X Windows System, its gets copied to PRIMARY clipboard.
Selecting a clipboard & explicitly copying it using Ctrl+C causes it to be copied to secondary keyboard.
In linux, I made a dictionary that automatically searches for word that is selected in current window. For that, I just copied the value of primary clipboard.
What's the equivalent of PRIMARY selection in windows? I want to retrieve the current selection in the current window using python.
Upvotes: 2
Views: 830
Reputation: 613461
There is no equivalent in Windows. There is just the single global clipboard which contains a single item, albeit in potentially multiple formats.
I want to retrieve the current selection in the current window.
That's not trivial in Windows. You can do it using, for example, UI Automation, for apps that support UI Automation. Most modern apps do support that but more obscure ones will not readily yield the information you are after.
Upvotes: 2