Click menu TT -> Other triggers.
Insert this text near the end, before the last }.
Click Run.
Insert this text near the end, before the last }.
Click Run.
[Triggers]
void ClipboardTriggers() {
var w1 = WndUtil.CreateMessageOnlyWindow(static nint (wnd w, int msg, nint wp, nint lp) => {
if (msg == api.WM_CLIPBOARDUPDATE) {
print.it("Clipboard trigger");
//if want to get clipboard text, do it with a delay, else it may interfere with other clipboard programs or scripts
timer.after(100, _ => {
var s = clipboard.text;
print.it(s);
});
}
return api.DefWindowProc(w, msg, wp, lp);
}, "#32770");
api.AddClipboardFormatListener(w1);
}
unsafe class api : NativeApi {
[DllImport("user32.dll", EntryPoint = "DefWindowProcW")]
internal static extern nint DefWindowProc(wnd hWnd, int msg, nint wParam, nint lParam);
internal const int WM_CLIPBOARDUPDATE = 0x31D;
[DllImport("user32.dll")]
internal static extern bool AddClipboardFormatListener(wnd hwnd);
}