On Clipboard Set Event - Printable Version +- Antwise community forums (https://forums.antwise.com) +-- Forum: Antview (https://forums.antwise.com/forumdisplay.php?fid=11) +--- Forum: Antview for Windows (https://forums.antwise.com/forumdisplay.php?fid=12) +--- Thread: On Clipboard Set Event (/showthread.php?tid=127) |
On Clipboard Set Event - maddire - 2022-07-06 Hi, Is there a way to trigger an event when the clipboard is written to? I am using google Maps and when a coordinate is clicked using the right click context menu, the coordinates will copy to the clipboard. I can use a timer to check for a change in windows clipboard but this is problematic as it will run system wide rather than at a specific event To note: Edge will pop up 'Copied to clipboard' when data is written to the clipboard. RE: On Clipboard Set Event - wila - 2022-07-06 Hi, I'm not aware of any specific functionality for this exposed by WebView2. In your case I would be looking into trying to do this from javascript. This link is a starting point for that: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard So add the event-listener via ExecuteScript with code like: Code: function myOnCopyEvent() { Code: document.querySelector("body").addEventListener("copy", myOnCopyEvent); I just tested that in MS Edge developer toolbox and it did indeed display the console log message. FWIW, I'm using the html "body" selector here, but if you have something more specific then that should work as well. Instead of writing to the console log you could then send a webmessage (see the webmessage demo in VB6 that comes with AntView) to trigger an event. Based on that event triggering you can then read the clipboard from your application. -- Wil |