title: Copy to Clipboard in Ruby, HTML or C#
body: <p>How do you copy text to the clipboard in Ruby?</p>
  
  <p>Sounds simple right? But I've been trying to do this for 5 days now, with no success. </p>
  
  <p>I searched on internet, but all I got is how to do it in newer versions of Ruby (I'm using 1.8.7 and no I can't use a newer version). </p>
  
  <p>So I tried making a HTML file to do it for me. After trying 4-5 different ways (from online guides), in 3 browsers, and even looking at Photobucket's source code to try figuring how it copies img codes, I gave up. Nothing worked for me. </p>
  
  <p>So I made a C# .exe and made my Ruby program call it. Finally something is being sent to the clipboard. It's a step forward, but still, it's only the first word in a string. When I try copying <code>two words</code>, only <code>two</code> is copied.</p>
  
  <p>my Ruby program looks like this:</p>
  
  <pre class="lang-rb prettyprint-override"><code>system  ("CopyClip.exe #{text}")
  </code></pre>
  
  <p>and in C# (in CopyClip), it does:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>Clipboard.set_text(args[0])
  </code></pre>
  
  <p>Basically, I don't care if you help me do it in Ruby, HTML, C#, or any other language, as long as it works.</p>