title: AppleScript create URL & anchor text, pass to clipboard as URL type data
body: <p>Is there a way to take a text label and an URL and use Applescript add them to the Mac clipboard such that rich-text apps see the data as a URL and make linked anchor text when pasting in the data.</p>
  
  <p>I have untitled reference URLs (generated via code) that need to have a 'screen' title (anchor text). I can create the URL and anchor text. But, how do I combine them so that the Mac clipboard treats the data as a URL? I tried:</p>
  
  <pre><code>set the clipboard to "&lt;a href=\"" &amp; theURI &amp; "\" target=\"_blank\"&gt;" &amp; theAnchor &amp; "&lt;/a&gt;"
  </code></pre>
  
  <p>..but when using this data from other apps I get the HTML string and not a link with the anchor text as the visible screen text.</p>
  
  <p>StandardAdditions has 'URL' and 'web page' classes but I can't see how to apply them. This compiles but fails when run:</p>
  
  <pre><code>set myURL to theURI as URL
  set myLinkAnchor to theAnchor as text
  set linkURL to {URL: myURL, name: myLinkAnchor} as web page
  </code></pre>