Restoring clipboard fails in some cases
Posted: 09 Mar 2014, 13:03
Hi, I'm trying to temporarily save and restore clipboard contents using the standard example from documentation (below). Unfortunately it doesn't work in many cases.
For example, run the script below and then
- copy image from the top of this forum page by right-clicking on image and selecting "Copy Image",
- press Alt-X, note the delay because ClipWait is not successful,
- open Paint or similar and try to paste with Ctrl-V. Nothing happens, clipboard is lost.
Is this a known issue, a bug or I miss something? Is there a way to do this for any clipboard content?
For example, run the script below and then
- copy image from the top of this forum page by right-clicking on image and selecting "Copy Image",
- press Alt-X, note the delay because ClipWait is not successful,
- open Paint or similar and try to paste with Ctrl-V. Nothing happens, clipboard is lost.
Is this a known issue, a bug or I miss something? Is there a way to do this for any clipboard content?
Code: Select all
!x::
ClipSaved := ClipboardAll ; Save the entire clipboard to a variable of your choice.
; ... here make temporary use of the clipboard, such as for pasting Unicode text via Transform Unicode ...
Clipboard =
Clipboard := ClipSaved ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
ClipWait, 2, 1
ClipSaved = ; Free the memory in case the clipboard was very large.
msgbox done...
return
esc::exitapp