Hallo,
although the function PasteThis(text) is already left before, the clipboard is not restored until 500 ms after the paste with ^v. Could be disadvantageous if you need the clipboard during this period.
But if PasteThis(text) is called within this period, it waits until the restoration is finished.
"Clipboard :=" does not always empty the clipboard immediately Topic is solved
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
Also running an ESET NOD32 scan, my worst-case fear is that my Clipboard might be hijacked!
ESET doesn't specifically mention Clipboard hijacking, so if anyone knows of another trusted, reliable tool to check for Clipboard hijacking, please share!
ESET doesn't specifically mention Clipboard hijacking, so if anyone knows of another trusted, reliable tool to check for Clipboard hijacking, please share!
Re: "Clipboard :=" does not always empty the clipboard immediately
Possible workaround:
Code: Select all
tmp := Clipboard, cx := A_CaretX, cy := A_CaretY
Sleep, 25
Send ^v
While (cx=A_CaretX) && (cy=A_CaretY)
Sleep, 25
Clipboard := tmp
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
@Rohwedder
Hello again!
Noticed today that while the Paste part of the function is working and pasting the right thing, the Clipboard is not restored (it contains the pasted text). At least that's what's happening on my side. Is it working for you?
Re: "Clipboard :=" does not always empty the clipboard immediately
Hallo,
the clipboard will be restored! However, not immediately but 500 ms later, the value of the line SetTimer, restoration, -500.
Try to reduce this value until the paste just works.
the clipboard will be restored! However, not immediately but 500 ms later, the value of the line SetTimer, restoration, -500.
Try to reduce this value until the paste just works.
Re: "Clipboard :=" does not always empty the clipboard immediately
This works in Notepad, it pastes, and the SoundBeep only occurs once it's completed. You can confirm this by putting large amounts of text on the clipboard.
Code: Select all
q:: ;notepad - PasteWait
SendMessage, 0x302,,, Edit1, A ;WM_PASTE := 0x302
SoundBeep
return
w:: ;active control - PasteWait
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x302,,,, % "ahk_id " hCtl ;WM_PASTE := 0x302
SoundBeep
return
e:: ;active window - PasteWait
SendMessage, 0x302,,,, A ;WM_PASTE := 0x302
SoundBeep
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately Topic is solved
@jeeswg thank you so much for your continued efforts to crack this problem!
The version in the middle of your last post is the most successful approach that I've tried so far!!!
Perhaps too early to dance a little jig, but I've burnt it into a script where it will get used a lot, so I'll be able to monitor it.
a bit early for this → …but extremely encouraging
For anyone on the same track, here it is in function form with some documentation.
Huge thanks and congratulations for getting us this far, this has been quite a journey.
The version in the middle of your last post is the most successful approach that I've tried so far!!!
Perhaps too early to dance a little jig, but I've burnt it into a script where it will get used a lot, so I'll be able to monitor it.
a bit early for this → …but extremely encouraging
For anyone on the same track, here it is in function form with some documentation.
Code: Select all
;--------------- SafePaste
SafePaste() {
; A way of pasting that only returns control when the paste is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Ctrl + v, you don't know when the pasting is complete,
; so if you immediately reload the Clipboard, the new text may end up getting pasted...
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x302,,,, % "ahk_id " hCtl ;WM_PASTE := 0x302
}
Re: "Clipboard :=" does not always empty the clipboard immediately
That's great, btw I like the name SafePaste.
Could you give a full list of problem utilities, in case I or others get a chance to test them.
Just FYI, there are these:
And some more that I haven't really looked at (and that probably won't be too useful):
Could you give a full list of problem utilities, in case I or others get a chance to test them.
Just FYI, there are these:
Code: Select all
WM_CUT := 0x300
WM_COPY := 0x301
WM_PASTE := 0x302
WM_CLEAR := 0x303
WM_UNDO := 0x304
Code: Select all
WM_RENDERFORMAT := 0x305
WM_RENDERALLFORMATS := 0x306
WM_DESTROYCLIPBOARD := 0x307
WM_DRAWCLIPBOARD := 0x308
WM_PAINTCLIPBOARD := 0x309
WM_VSCROLLCLIPBOARD := 0x30A
WM_SIZECLIPBOARD := 0x30B
WM_ASKCBFORMATNAME := 0x30C
WM_CHANGECBCHAIN := 0x30D
WM_HSCROLLCLIPBOARD := 0x30E
WM_QUERYNEWPALETTE := 0x30F
WM_PALETTEISCHANGING := 0x310
WM_PALETTECHANGED := 0x311
WM_HOTKEY := 0x312
WM_PRINT := 0x317
WM_PRINTCLIENT := 0x318
WM_APPCOMMAND := 0x319
WM_THEMECHANGED := 0x31A
WM_CLIPBOARDUPDATE := 0x31D
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
Are you saying that you would like to see a post with a list like this for people to test?
Not sure what key WM_CLEAR would normally correspond to, so description is more brief.
Not sure what key WM_CLEAR would normally correspond to, so description is more brief.
Code: Select all
;--------------- SafePaste
SafePaste() {
; A way of pasting that only returns control when the paste is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Ctrl + v, you don't know when the pasting is complete,
; so if you immediately reload the Clipboard, the new text may end up getting pasted...
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x302,,,, % "ahk_id " hCtl ;WM_PASTE := 0x302
}
Code: Select all
;--------------- SafeCopy
SafeCopy() {
; A way of copying that only returns control when the copying is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Ctrl + c, you don't know when the copying is complete
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x301,,,, % "ahk_id " hCtl ;WM_COPY := 0x301
}
Code: Select all
;--------------- SafeCut
SafeCut() {
; A way of cutting that only returns control when the cutting is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Ctrl + x, you don't know when the cutting is complete
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x300,,,, % "ahk_id " hCtl ;WM_CUT := 0x300
}
Code: Select all
;--------------- SafeUndo
SafeUndo() {
; A way of undoing that only returns control when the undoing is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Ctrl + z, you don't know when the undoing is complete
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x304,,,, % "ahk_id " hCtl ;WM_UNDO := 0x304
}
Code: Select all
;--------------- SafeClear
SafeClear() {
; A way of deleting that only returns control when the deleting is complete
; by jeeswg
; See https://www.autohotkey.com/boards/viewtopic.php?p=271514&sid=f898e28c59efcb6871c1dff403e663dd#p271517
; the point of this is that with a simple Del, you don't know when the deleting is complete
ControlGetFocus, vCtlClassNN, A
ControlGet, hCtl, Hwnd,, % vCtlClassNN, A
SendMessage, 0x303,,,, % "ahk_id " hCtl ;WM_CLEAR := 0x303
}
Last edited by freespacing on 07 Apr 2019, 12:07, edited 1 time in total.
Re: "Clipboard :=" does not always empty the clipboard immediately
I mentioned the list because they provided what could be a way of safe copying/cutting (and pasting, as established earlier) for some applications.
The group of 5 messages corresponds to Notepad's Edit menu:
Undo, Cut, Copy, Paste, Delete.
The group of 5 messages corresponds to Notepad's Edit menu:
Undo, Cut, Copy, Paste, Delete.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
Thank you for clarifying. That sounds valuable. Edited the "docstring" in SafeClear.
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
@jeeswg
quick thought: it might be worth mentioning this method at the top of your PasteWait thread so that people who need help find a working solution fast without falling down the rabbit hole… Less work for you and others who are so active on the forum.
This issue had been plaguing me for years, I'm trilled.
Another thousand thanks.
On my end, will go edit the top post of this present thread.
quick thought: it might be worth mentioning this method at the top of your PasteWait thread so that people who need help find a working solution fast without falling down the rabbit hole… Less work for you and others who are so active on the forum.
This issue had been plaguing me for years, I'm trilled.
Another thousand thanks.
On my end, will go edit the top post of this present thread.
Re: "Clipboard :=" does not always empty the clipboard immediately
That's great, I'm pleased. I've added a mention to my PasteWait thread, and I've added to my clipboard section, here:
jeeswg's homepage - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=17&t=30931
And left a mention re. the clipboard, here:
jeeswg's Explorer tutorial - AutoHotkey Community
https://www.autohotkey.com/boards/viewtopic.php?f=7&t=31755
jeeswg's homepage - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=17&t=30931
And left a mention re. the clipboard, here:
jeeswg's Explorer tutorial - AutoHotkey Community
https://www.autohotkey.com/boards/viewtopic.php?f=7&t=31755
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 150
- Joined: 28 Sep 2016, 11:14
- Contact:
Re: "Clipboard :=" does not always empty the clipboard immediately
…and your home page is at the top of my AHK bookmarks. What an outstanding resource. Have a great week.
Who is online
Users browsing this forum: chrisjordan, teadrinker and 151 guests