ClipWait

Get help with using AutoHotkey and its commands and hotkeys
alancantor
Posts: 27
Joined: 11 Jun 2019, 11:28

ClipWait

04 Jan 2021, 00:40

Typical examples of ClipWait show what happens when text is copied to the clipboard, e.g.,

Code: Select all

clipboard := "" ; Empty clipboard
Send, ^c
ClipWait, 2
Does ClipWait wait until the clipboard contains data when text has been cut instead of copied? For example:

Code: Select all

clipboard := "" ; Empty clipboard
Send, ^x
ClipWait, 2
Is ClipWait an appropriate way to determine whether the clipboard has been successfully modified? E.g.,

Code: Select all

Clipboard = %Opener%%Clipboard%%Closer%
ClipWait, 0.75
SendInput ^v
User avatar
Xtra
Posts: 2060
Joined: 02 Oct 2015, 12:15

Re: ClipWait

04 Jan 2021, 02:04

Check ErrorLevel after using Clipwait and it will show if the copy failed for the timeout.
Rohwedder
Posts: 3974
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: ClipWait

04 Jan 2021, 03:21

Hallo,
if you want to be sure that the ClipBoard has been changed successfully:

Code: Select all

Clipboard := Test := Opener Clipboard Closer
While, ClipBoard <> Test
	Sleep, 50
SendInput ^v
User avatar
mikeyww
Posts: 5359
Joined: 09 Sep 2014, 18:38

Re: ClipWait

04 Jan 2021, 05:52

Answers:

Does ClipWait wait until the clipboard contains data when text has been cut instead of copied?
  • Yes, because the clipboard is populated following the cut.
Is ClipWait an appropriate way to determine whether the clipboard has been successfully modified?
  • Only if the clipboard is first empty, because ClipWait waits until the clipboard has been populated.
Your testing can quickly verify these things.
alancantor
Posts: 27
Joined: 11 Jun 2019, 11:28

Re: ClipWait

04 Jan 2021, 21:37

Thank you all for the clarifications about ClipWait.

And thank you especially for the suggestion to check for errors after ClipWait. There has been an unexpected benefit: now I have a better mechanism for checking when nothing is selected. In this cases, nothing gets copied to the clipboard when the macro runs. The revised script is more versatile than before.

Return to “Ask For Help”

Who is online

Users browsing this forum: ark, Bing [Bot], Spawnova and 38 guests