How to pause or temporarily disable OnClipboardChange?
On start, ToolTip is not triggered.
^c triggers OnClipboardChange and ToolTip (default behaviour).
!r sends "text" and triggers OnClipboardChange and ToolTip.
How do i stop !r from triggering OnClipboardChange?
What should i add to PasteText function to prevent OnClipboardChange from triggering?
I tried to use pause and suspend in various combinations, but none achieve my goal.
The goal -
PasteText function should never trigger OnClipboardChangem (pause or temporarily disable OnClipboardChange),
and other hotkeys/strings/functions (like !s) should trigger OnClipboardChange and ToolTip if clipboard is altered (keep default behaviour).
Any help would be appreciated.
Happy New Year!![Smile :)]()
CODE:
#SingleInstance force
#Persistent
#Requires AutoHotkey v1.1.37
clipboard := "" ; don't trigger ToolTip on start
OnClipboardChange:
if A_EventInfo != 1 ; if clipboard is empty or contains something entirely non-text such as a picture
return ; do nothing and don't trigger ToolTip on start
; various actions here such as
; SomeVar := SomeFunction(clipboard)
Tooltip, "Clip is triggered"
SetTimer, RemoveToolTip, -5000
Return
RemoveToolTip:
ToolTip
return
; ======
!s::
; some clipboard operation that triggers OnClipboardChange and ToolTip
return
!r::
pasteText := "text: 1000 words"
PasteText(pasteText) ; use clipboard to send big chunks of text - DONT trigger OnClipboardChange and ToolTip
return
PasteText(pasteText) {
suspend On ; Disables all hotkeys and hotstrings.
pause On, 1 ; Pauses the script's current thread, but continues execution of function
tmp := ClipboardAll
Clipboard = %pasteText%
Send ^v
; sleep 500
; Clipboard := tmp
; pause Off
; suspend Off
return
}
On start, ToolTip is not triggered.
^c triggers OnClipboardChange and ToolTip (default behaviour).
!r sends "text" and triggers OnClipboardChange and ToolTip.
How do i stop !r from triggering OnClipboardChange?
What should i add to PasteText function to prevent OnClipboardChange from triggering?
I tried to use pause and suspend in various combinations, but none achieve my goal.
The goal -
PasteText function should never trigger OnClipboardChangem (pause or temporarily disable OnClipboardChange),
and other hotkeys/strings/functions (like !s) should trigger OnClipboardChange and ToolTip if clipboard is altered (keep default behaviour).
Any help would be appreciated.
Happy New Year!

Statistics: Posted by xypha — Today, 07:56