This tip is about something that I have found to be a very handy time-saver.
I use CHS
a lot, and sometimes I want to:
(a) first, paste as plain (unformatted) text something that I have just copied, into a document.
(b) second, paste the same text - but with all its
original formatting - into a different document.
I can't do this with CHS.
This post explains why, and how to get a reasonably good workaround to that, using an AHK script.
Using CHS, when you copy something (text or image) to the clipboard, it gets saved in CHS as either image or text.
An image on its own is saved as an image, in CHS.
Text is saved as text without the formatting, in CHS.
Images and text copied combined in a single clip together are saved as
either image, or text, depending on your CHS priority setting.
But whatever was in the clipboard buffer (image, or text, or image and text) remains as is - including any text formatting - until it is overwritten by the next copy action
or by CHS.If you paste the last clip that was copied into the clipboard buffer, then it is pasted intact from the clipboard buffer, together with its formatting (includes any objects in the clip also).
But, if you use the CHS command to paste it as plain (unformatted) text, then CHS apparently removes the formatting - effectively overwriting the clipboard buffer with plain (unformatted) text - and that buffer's content is then pasted into your document.
Having done that, if you then want to paste the
formatted text anywhere else
- you cannot paste it. This is because the formatted text does not exist in the clipboard buffer, having been overwritten by the plain (unformatted) text. (This can be
very frustrating at times!)
There is an AutoHotKey script which provides a handy and time-saving workaround for this.
To use it, first disable any keyboard hotkeys that may be set in CHS to force a plain (unformatted) text paste. So CHS does not change whatever text and formatting it finds in the clipboard buffer - i.e., it always pastes what is in the buffer.
The AHK script intercepts these key combo inputs, and takes action as shown:
- Ctrl+Shift+V: this causes the formatted text to be pasted.
- Ctrl+V: this causes the plain (unformatted) text to be pasted.
(You can change the script to use other key combos, if you want. These particular ones suit the ergonomics of my way of working to a "T".)
The AHK script works thus:1. When
Ctrl+Shift+V is pressed: the keyboard string "Ctrl+V" is passed to the system, causing a normal (unmodified) paste of whatever is in the clipboard buffer.
2. When
Ctrl+V is pressed:
(a) the current as-copied formatted text contents (alas, minus any accompanying image objects) of the clipboard buffer are saved intact;
(b) the contents of the clipboard buffer are overwritten with the plain (unformatted) text (i.e., formatting is removed);
(c) the keyboard string "Ctrl+V" is passed to the system, causing a normal (unmodified) paste of whatever is in the clipboard buffer.
(d) the saved as-copied formatted text is restored to the clipboard buffer (minus any accompanying image objects that may have been in the original clip).
This is a copy of the AHK script:
Spoiler
;-------------------------------------------------------------------
$^v:: ; Intercept Ctrl+v to send an UNformatted Paste
Gosub, UnformattedPaste ; Text–only unformatted paste from ClipBoard
return
;-------------------------------------------------------------------
$^+v:: ; Intercept Ctrl+Shift+v to send a Formatted Paste
Send ^v ; Normal paste (sends full contents and formatting of Clipboard)
return
;-------------------------------------------------------------------
;-------------------------------------------------------------------
UnformattedPaste: ; Text–only unformatted paste from ClipBoard
ClipSaved := ClipboardAll ; save original clipboard contents
Clipboard = %Clipboard% ; Convert to text + remove formatting
Send ^v ; send the Ctrl+v command
Clipboard := ClipSaved ; restore the original clipboard contents
ClipSaved = ; clear the variable
Return
;-------------------------------------------------------------------