My Goal is to detect what myself or someone has copied to the clipboard, using CTRL+C, or the right click and using the context menu.
I know my AIR Application isn't always in focus, since other things are going on in the desktop (switching from browser to browser, editing photos in Fireworks, etc.....)
But I do tend to copy text to the clipboard often. And I really want to detect when I do, even if my AIR App is minimized or Headless.
So, I created the following code that simply uses the Javascript setInterval() method, set at 1 second. And it basically runs another function that is supposed to get the clipboard details.
It's not working. Can someone see if I'm doing it wrong, or if it even can be done?
------------------------------------------------------------------------------------------ --------------
<div id="infoDiv"></div>
<script>
function everysecond() {
setInterval("checkClipBoard()",1000);
}
function checkClipBoard(){
if(air.Clipboard.generalClipboard.hasFormat("text/plain")){
var text = air.Clipboard.generalClipboard.getData("text/plain");
}else{
var text = "nothing in clipboard";
}
$("#infoDiv").html(text);
}
everysecond();
</script>
------------------------------------------------------------------------------------------ --------------
Thank you!