title: How to assign contents of clipboard to array in openoffice BASIC macro
body: <p>I'm trying to create a rudimentary glossary macro for a LibreOffice/OpenOffice .odt file.
  It will go to the end of the document and paste a list of selected words(found by regex) as a unique set (no doubles)</p>
  <p>Where I'm falling down is that once the text has been copied to the clipboard, I need to assign the contents to a variable so that I can create a set.</p>
  <p>In OpenOffice's implementation of BASIC, how does one assign the contents of the clipboard to a new variable?</p>
  <p>To be clear: I don't need the Paste function, I need to manipulate the contents of the clipboard as an Object before calling Paste</p>
  <p>A rough draft of what I'm trying to do is:</p>
  <pre><code>dispatcher.executeDispatch(document, &quot;.uno:Copy&quot;, &quot;&quot;, 0, Array())
  
  rem -------------- PROBLEM IS BELOW -------
  Dim oModuleUICommandDescription As Object, myText$(),aCommand
  myText = thisComponent.currentSelection(0)
  
  rem -------------- PROBLEM IS ABOVE -------
  
  rem -------------- Followed by an array comparison to get a unique set
  
  i = FreeFile()
  Open &quot;/path/to/my/BASIC.txt&quot; For Output As i
  Print #i, myText.string
  Close #i
  </code></pre>