Set Clipboard in OSC to Outside OSC

I found that globals.clipboard is a global variable which can be read inside OSC. Is it possible to set the clipboard so I can take a value from an OSC widget and add it to my clipboard outside of OSC?

globals.clipboard.writeText() is not a function currently. However, the documentation states that the globals.clipboard is an instance of the Navigator.clipboard. Are the methods not exposed?

Cheers,
DMDComposer

As far as I can tell, globals.clipboard.writeText() and globals.clipboard.readText() are working correctly although the latter requires an authorization when used in the browser.

I updated to the latest version v1.19.2 (the release says v1.19.2, but OSC still shows it as v1.19.1).

I created a button and the following script on a button in the onValue script section.

globals.clipboard.writeText("Hello")

I receive the following error:

TEST BUTTON.onValue javascript error at line 2: TypeError: Cannot read properties of undefined (reading 'writeText')

I even tested in a blank session with no custom modules/themes to make sure it wasn't a custom thing I was breaking.

I tried the electron browser window from OSC, as well as just accessing the browser ipAddress:port, both error out. However, in the browser I get a slightly different error

TEST BUTTON.onValue javascript error at line 2: TypeError: globals.clipboard is undefined

Hmm I guess it depends on the OS then, try with https (use-ssl option), its use may be restricted to secure contexts.

1 Like

Thanks Jean! Using SSL fixed the issue.

I'm on windows 11 just in case you were curious about which OS I was testing this on.

Cheers!

I figured it was windows, but I can't test on windows (nor mac), nothing but linux on my machines.

1 Like