Clipboard contents into a variable?

Is there a straightforward way of capturing the current system clipboard contents into a variable (in a userscript)? The only workaround I can think of is to paste the clipboard contents into the file, select it, get it into a variable, and then remove it from the file.

Here you go:

:slight_smile:

Thank you, but that appears to be applicable only to add-ons and not userscripts. (I’m currently seeing how far I can go solely with userscripts in order to replace all of my old jEdit macros as quickly as possible. Learning how to develop Komodo IDE add-ons is something I’m planning on doing, but not yet.)

It’s not. You can require stuff in userscripts too.

As Defman suggested, Addons and UserScripts both have access to the exact same API’s.

But I don’t see clipboard listed in the Komodo IDE SDK, which I thought we were limited to.

So would it be done using require(“sdk/clipboard”)?

It’s under Mozilla APIs.

Okay, thanks. I somehow got the idea that userscripts could only use all the methods found in the three drop-down menus at http://docs.activestate.com/komodo/11/sdk/api/, while the methods discussed on the “Mozilla SDK” page was for add-ons only.

Both add-ons and userscripts are sharing the same scope - a Komodo window, which has both ko/ and sdk/ CommonJS namespaces.