Script Gui Text Field Clipboard Quirks

I’ve been experimenting a bit more with scripting lately and exploring a few ideas. I use custom LFOs all the time to build interesting DSP chains, so I’m naturally exploring various script ideas that involve generating the custom LFO envelope points automatically. It’s not yet possible to access the LFO envelope points with scripting, due to the slightly limited interface to the device properties, as briefly explained in this other thread:

Hopefully this can be improved at some point in the future as Taktik says, but in the meantime I’m forced to think about possible workarounds. One obvious thing that springs to mind is to have my script generate the XML for the envelope points instead, so that the user can copy this from a textfield in my script GUI, and then paste it directly into the LFO itself. But I’ve hit some rather annoying quirky clipboard behaviour with the script GUI text fields. (And indeed any text field that is native/internal to Renoise, it seems)

Let’s imagine that I’ve generated the following chunk of XML:

<?xml version="1.0" encoding="UTF-8"?>  
<envelopeselectioncontent doc_version="0"><br>
  <points><br>
    <point>0,0.0</point><br>
    <point>1,0.5</point><br>
    <point>2,1.0</point><br>
  </points><br>
<rangelength>3</rangelength><br>
</envelopeselectioncontent>  
  

And I output it to a text field in my script GUI:

If I copy this chunk of XML from the text field in Renoise, I can see it physically go into the Windows clipboard (Start Run > clipbrd), but when I try to paste it back into the LFO envelope in Renoise… nothing happens.

If I copy the same XML from an external app such as Notepad and paste it into Renoise, then it works normally. Renoise correctly sees that there is XML on the clipboard, and it inserts the points into the LFO envelope as expected.

I tried it with a scripted text field, the scripting terminal & editor itself, and even the song comments editor, but they all seem to exhibit the same ‘problem’. Whatever Renoise is doing to interpret the clipboard text and convert the XML into working object data, it does not seem to be triggered when copying XML from internal text fields. It only works when the XML is copied from an external app such as Notepad.

Have I missed something in the scripting API, like some kind of property or notifier that can alter this clipboard behaviour, or has this simply been overlooked thus far? If it has been overlooked, it would be great if this could be fixed in a future update, so that Renoise will perform the XML-to-data conversion when copying from internal text fields.

Improved access to the device properties would of course be preferable, but I’m guessing that will take a lot longer to implement? I’ve sort of hit a brick wall here with what I want to do, so it’s a little bit frustrating.

Oh by the way… I’m not sure if operating system has anything to do with the clipboard quirk, but nevertheless I’m on Win XP Pro SP3 32-bit.

I had problems copying text from text-dialogs in the scripts using the keyboard shortcuts. However if i rightclick the selection and then clicked “copy” in the context-menu explicitly, this seemed to work ok.
Might that be the solution to the problem?
We perhaps need a clipboard function in the Lua environment. The only clipboard function we currently have is the alternative clipboard selection (switching between clipboard 1 to 4).

Nope. This was one of the first things I tried as well. As I mentioned earlier, I’ve used the Windows clipboard viewer to confirm that the correct data is being copied, so there’s no problem with that side of it.

Renoise seems to maintain multiple context-sensitive clipboards internally for each type of data/object. For example, I can copy a block of pattern data, then copy a DSP device, then copy an instrument, then copy some text from an edit field. If I now go back to any of these independent parts of Renoise and use the paste function, the correct corresponding data is pasted back: pattern data pastes into the pattern editor, a DSP device pastes into the DSP chain, an instrument pastes into the instrument list, and a string of text pastes back into an edit field.

Now, if I copy a chunk of valid XML from Notepad and switch back to Renoise, this will replace the corresponding clipboard data in Renoise, depending on whatever object type the XML describes. This is also why you can’t (easily) paste a chunk of XML into a text field in Renoise, because Renoise doesn’t actually see it as text… it sees it as an object that should be pasted somewhere else, like the DSP chain, pattern editor, etc.

But if I copy a chunk of valid XML from an internal text field in Renoise itself, this translation of clipboard XML to object data doesn’t seem to take place. It appears as if Renoise is treating it purely as a string of plain text and nothing else. If this is the case, then I think we could be missing out on some rather useful functionality here.