title: Applescript to get the URL from Safari
body: <p>I'm trying to get the URL from Safari, close the tab and open it in Chrome ( <a href="http://www.google.com/url?sa=t&amp;source=web&amp;cd=3&amp;ved=0CDIQFjAC&amp;url=http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/&amp;ei=GTdaTr7VMs7Gswaf3NmnCw&amp;usg=AFQjCNE_4K1EqgCOC3tmUiiiRDMyhKPv-w&amp;sig2=jPK1vMai1fZVrmX97nBYBw" rel="nofollow">TUAW Post</a> ) But I keep getting the error:</p>
  
  <pre><code>error "Safari got an error: Can’t get current tab." number -1728 from current tab
  </code></pre>
  
  <p>From the code line:</p>
  
  <pre><code>set theURL to URL of current tab of window 1
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>All the code:</p>
  
  <pre><code>property theURL : ""
  
  tell application "Safari"
  
      set t set theURL to URL of current tab of window 1
      close current tab
  
  end tell
  
  tell application "Google Chrome"
  
      set URL of active tab of window 1 to theURL
  
      activate
  
  end tell
  </code></pre>