Not sure you can even grab this in code but I’m trying to get back the selected text from the scriptEditor History / Reporter. I’m doing some hackery so that you can select text in the editors and on the popupMenu run an autoInspect that will allow you to go straight to debugging that function it in the editor of your choice.
After a lot of poking around I’ve found the main calls but there doesn’t seem to be a way to return the selected text from the history, just from the editor portion of the scriptEditot. I know you can copy the selected txt, but I want the selected text returned so I can pass it into my function.
Are you trying to copy text from the cmdScrollFieldExecuter, or the cmdScrollFieldReporter?
If it’s the reporter, I think the only way is going to be to copy the selected text, and then use ctypes/win32api or PyQt/PySide to query the clipboard and restore the original clipboard afterwards.
(ctypes is more complicated, but there’s plenty of examples with complete code for get/set clipboard)
Another easy way would be to convert the scroll reporter to a QTextField and then just use that to query selected text.