title: Apple Script : How can I copy html content to the clipboard?
body: <p>I know how to copy plain text to the clipboard:</p>
  
  <pre><code>oascript -e 'set the clipboard to "plain text"'
  </code></pre>
  
  <p>But the question is how can I copy html contents to the clipboard?
  For example, how can I copy the following html content to the clipboard:</p>
  
  <pre><code>&lt;b&gt;bold text&lt;/b&gt;
  </code></pre>
  
  <p>so that I get bold text when I paste it in TextEdit?  </p>
  
  <p>Thanks for the help in advance!</p>
  
  <hr>
  
  <p>I found an intermediate solution for this:</p>
  
  <pre><code>echo "&lt;b&gt;bold text&lt;/b&gt;" | textutil -stdin -stdout -format html -convert rtf | pbcopy
  </code></pre>
  
  <p>This works, so far so good, but unfortunately I found that it doesn't work for an image tag:</p>
  
  <pre><code>echo "&lt;img src=\"https://www.google.com/images/srpr/logo3w.png\"&gt;" | textutil -stdin -stdout -format html -convert rtf | pbcopy
  </code></pre>
  
  <p>This does not do the job I want, so anybody knows the reason?<br>
  Thanks!</p>
  
  <hr>
  
  <p>I've found a working solution and posted it below :)</p>