Causes the specified function to be called automatically whenever the clipboard's content changes.
OnClipboardChange Function , AddRemove
Type: Function Object
The function object to call. The function's parameter and return value are described below.
If omitted, it defaults to 1 (call the function after any previously registered functions). Otherwise, specify one of the following numbers:
The function should accept one parameter:
One of the following numbers:
If this is the last or only OnClipboardChange function, the return value is ignored. Otherwise, the function can return a non-zero integer to prevent subsequent functions from being called.
If the clipboard changes while an OnClipboardChange function is already running, that notification event is lost. If this is undesirable, use Critical. However, this will also buffer/defer other threads (such as the press of a hotkey) that occur while the OnClipboardChange thread is running.
If the script itself changes the clipboard, its OnClipboardChange functions are typically not executed immediately; that is, functions immediately below the function that changed the clipboard are likely to execute beforehand. To force the functions to execute immediately, use a short delay such as
Sleep 20 after changing the clipboard.
A_Clipboard, OnExit, OnMessage, CallbackCreate