How to force a program to send highlighted text to the clipboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Consolarificus
Posts: 19
Joined: 10 Feb 2016, 09:00

How to force a program to send highlighted text to the clipboard

26 Jul 2017, 09:54

I often use a program which refuses to send the highlighted text to the clipboard. There is a "Send to Clipboard" option, but it doesn't do anything – or I don't have the rights. I'm able to highlight text, so I should be able to send to the clipboard :?

Is there any way to bypass this limitation/restriction and manually send the highlighted text on screen to the clipboard (i.e. other than using Send, ^c)? Of course I'd be using #IfWinActive to target the specific program.

Thanks kindly.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 10:10

You could have another try using ControlGetText. You very last resort > OCR :wtf:
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 11:08

If the program window is actively trying to prevent you from coping and pasting then it is probably going to be very difficult to copy and paste.

A secured PDF for example will allow you to highlight text but not copy it to the clipboard.

You can use the Window Spy tool that comes with AHK. If when you select the window with the tool if it does not display the text in the "Text" field of the tool then ControlGetText will not work.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
Consolarificus
Posts: 19
Joined: 10 Feb 2016, 09:00

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 12:28

BoBo wrote:You very last resort > OCR :wtf:
I know you were half kidding there, but I actually attempted this using an OCR script posted here, and the hotkey returned the text I had previously copied... It completely ignored my copying attempts of the selected text in the troublesome program.

Gonna throw the towel and keep on re-typing manually :(
Guest

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 13:02

FanaticGuru wrote:A secured PDF for example will allow you to highlight text but not copy it to the clipboard.
Locked/secured PDFs are quite easy to unlock using Ghostscript (free, open source) - just google "unlock pdf ghostscript" and you'll find various solutions. Personally I've never had it fail, but apparently there are some documents that will resist this method. Free software FTW :-)
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 14:23

"unlock pdf google chrome" will provide some details as well.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 14:29

Sometimes this works, I wish people would mention it more often. I.e. try AccViewer, and if it can get text, you can get the text via the Acc library.
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: How to force a program to send highlighted text to the clipboard

26 Jul 2017, 19:08

Guest wrote:
FanaticGuru wrote:A secured PDF for example will allow you to highlight text but not copy it to the clipboard.
Locked/secured PDFs are quite easy to unlock using Ghostscript (free, open source) - just google "unlock pdf ghostscript" and you'll find various solutions. Personally I've never had it fail, but apparently there are some documents that will resist this method. Free software FTW :-)
For the record, I just downloaded Ghostscript and googled a command line series of options to basically recreate a copy of a PDF without the password.

It worked well on the one simple secured PDF I tried. It is important to realize that it is not removing the password on a PDF. It is creating a new PDF that is a pretty good clone of the original by basically printing it to a new PDF. The file size is changing significantly so something is changing (probably resolutions) so I would have to evaluate it carefully on important complex documents but looks very suitable for just creating a document that I can copy and paste from to save some typing.

An AHK script that makes the file selecting easer and automatic new naming of clone without having to play with a command line in the Command Prompt would be nice.

All-in-all, pretty nifty. I don't often need to break the security on PDFs but the batch modifying and converting that Ghostsript offers could be useful. Especially with some AHK script to help the process.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
Consolarificus
Posts: 19
Joined: 10 Feb 2016, 09:00

Re: How to force a program to send highlighted text to the clipboard

27 Jul 2017, 06:49

jeeswg wrote:Sometimes this works, I wish people would mention it more often. I.e. try AccViewer, and if it can get text, you can get the text via the Acc library.
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
Thanks for mentioning it. Unfortunately, no luck with this either.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], TAC109 and 114 guests