Ableton Live and the system clipboard

I have been struggling with a problem today and although it turns out that it’s almost certainly not Juce specific, I thought I would mention it here anyway.

I have made a VST plugin that copies a request code to the clipboard during authorization, to be pasted into a browser by the user. I have only tested on the PC by the way and it works fine in Cubase and Reaper, but in Ableton Live (Live Lite v8.010), the contents of the system clipboard sometimes seem to get ‘rolled back’ when switching from Live to any other application. This is a pain in the rear when you are trying to paste a request code from a plugin into a browser as I am.

The only way that I have managed to work around this is to save the request code to a file and then run a separate executable that reads the file, pops up a window (to remove focus from Live) and then copies the request to the clipboard. I have integrated this pretty seamlessly with my plugin, so I’m not looking for another solution, but I wondered if anyone else had experience this sort of thing, or is it just me?

Hmm - very annoying.

You could try starting a timer to keep repeatedly pasting your content to the clipboard for a few seconds?

I have tried a few different things. The text gets onto the clipboard fine and I can paste it into another part of my plugin. It’s only when the user switches apps away from Live that the clipboard contents are mysteriously reverted to their previous state. The app switch happens manually as I haven’t implemented an automated authorization process. I suspect that Live is intentionally doing this for a reason of its own that escapes me. By the way I am testing with Windows 7 64-bit and haven’t tried any other operating systems.

Yes - that’s what I meant. Your timer could detect the app switch and keep checking for the clipboard contents to change, then it could re-paste the correct data.

That sounds like it should work. Now that I think of it, I need to detect app switches on a timer so that I can move the right window to the front for my plugin when switching back to the host, so your idea could dovetail with that nicely. I’ll give it a try - thanks.

By the way, since I recently discovered how incredibly useful the Juce URL class is, I have managed to implement automated product activation direct with my web-site via ssl, bypassing all of the mucking about with the clipboard. I’m only using it as a fallback now.