Pasting as plain text in Windows 10 using AHK

Associate
Joined
10 Apr 2008
Posts
2,491
MacOS allows you to do this with a simple shortcut, but on Windows I'm having to use AutoHotKey with this script:

$^v:: ClipSaved := ClipboardAll ;save original clipboard contents clipboard = %clipboard% ;remove formatting Send ^v ;send the Ctrl+V command Clipboard := ClipSaved ;restore the original clipboard contents ClipSaved = ;clear the variable Return $^+v:: Send ^v ;just send the regular paste command Return

From here: https://lifehacker.com/5388814/better-paste-takes-the-annoyance-out-of-pasting-formatted-text

Problem is whenever I paste using with this script active, the last line of every paragraph is inserted with a line break. Does anyone know what the problem might be? I've tried multiple scripts and this bug is really annoying. Happens with all of them.
 
Various things. PDFs usually. Sometimes web pages. In theory it shouldn't matter though because any formatting is supposed to be gone.

I used to run a similar script on Windows 7 before I moved to MacOS, no problems.
 
Not sure if this is what you want but may help you.

The idea behind this is you run it and while running, highlight text and hit Q to copy it. it's then auto-pasted into a notepad file in the script directory. You then hit ESC when you want to end the script. This also copies the page number as it was written for PDF's.

You could run this for copying what you need and then just copy the text from the notepad file into wherever you need it.

q::
send, ^c
ClipWait
ControlGetText, readerp, Edit2, A
; msgbox, Page Title %clipboard% Page Number %readerp% ;if you want to test
FileAppend, %clipboard% Page %readerp%`n, terms&conditions.txt
return
esc::ExitApp

Maybe it'll help you figure it out, if not, try the AHK forums, they are very helpful on there.
 
Back
Top Bottom