title: Set current directory - apple script
body: <p>I have an application and a <code>.sh</code> file. I need an apple script that when double clicked, sets the permission of that <code>.sh</code> file and runs it.
  Below is my code:</p>
  
  <pre><code>set app_directory to POSIX path of ((container of (path to me)) as text)
  
  tell application "Terminal" to do shell script "chmod 777 " &amp; app_directory &amp; " start.sh"
  tell application "Terminal" to do shell script app_direcory &amp; "start.sh"
  </code></pre>
  
  <p>But I get following error:</p>
  
  <blockquote>
    <p>error "Can’t make container of alias \"Macintosh HD:Users:santhosh:Desktop:EPPFN ver1:Barcode Application_mac:test_app.app:\" into type text." number -1700 from container of alias "Macintosh HD:Users:santhosh:Desktop:EPPFN ver1:Barcode Application_mac:test_app.app:" to text</p>
  </blockquote>
  
  <p>How do I set the current path and then use the relative path to run the script.</p>
  
  <p>EDIT:
  I modified the code to:</p>
  
  <pre><code>set x to POSIX file ((POSIX path of (path to me)) &amp; "/..") as text
  set thescript to ("chmod 777 " &amp; x &amp; "start.sh") as text
  tell application "Terminal" to do shell script (thescript)
  </code></pre>
  
  <p>still no luck.</p>