Background
I have a program that calls various functions based on hotkeys and the clipboard. I am using pyperclip
and aoikhotkey
. This combination is working very well. However, I would like to improve it even more if possible. Currently, my workflow is as follows:
- Highlight target text using my mouse
- Press Ctrl+c to put it in the clipboard
- Press my hotkey combination to call the function which uses the clipboard content.
I would like to eliminate step 2 and have the function called by the hotkey "scrape" the content on my screen (possibly using mouse or cursor event monitoring).
Question
Does anyone have any ideas about how I can do this? I suspect that I might be able to use Tkinter
somehow to accomplish this, but I don't have any experience working with Tkinter
, so if anyone has any suggestions or hints, I would be grateful.
Reference
Here's a post asking a similar question, but using the Autohotkey scripting language:
Get Selected Text Without Using the Clipboard
Update
The title of this question was originally "Getting selected text without using the clipboard". However, I changed it because the comments section to this question helped clarify my actual needs and goals.