title: Applescript to open terminal, run command, and show - Not working
body: <p>I´m trying to create a keyshortcut to open terminal in current folder. Looking around, I found this code to create a service (the part of adding the shortcut to this service is solved), only added things are the "; clear" and some of the "activate" so it shows</p>
  
  <pre><code>on run {input, parameters}
  
  tell application "Finder"
      activate
  
      set myWin to window 1
  
      set theWin to (quoted form of POSIX path of (target of myWin as alias))
  
      tell application "Terminal"
  
          activate
          tell window 1
              activate
              do script "cd " &amp; theWin &amp; ";clear"
          end tell
  
      end tell
  
  end tell
  
  
  return input
  
  end run
  </code></pre>
  
  <p>It is not working as i would like.</p>
  
  <p>troubles:</p>
  
  <ul>
  <li>it opens two windows in terminal, have no idea why. It has nothing to
  do with the added "activate"… it has always donde that </li>
  <li>if I select an item on finder ( a folder ) it opens its parent directory and i would
  like it to open the selected folder</li>
  </ul>
  
  <p>this is my very first try with Applescript so if the error is obvious i just can't see it</p>
  
  <p>Thanks in advance</p>