<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}</DIV><DIV>echo "$query" > textmatetostata.do</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>osascript -e 'on run(argv)</DIV><DIV>tell application "Stata"</DIV><DIV>activate</DIV><DIV>open POSIX file ((item 1 of argv as string) & "/textmatetostata.do")</DIV><DIV>end tell</DIV><DIV>end run' -- "$TM_PROJECT_DIRECTORY"</DIV><BR><DIV><DIV>On Dec 10, 2006, at 5:05 AM, <A href="mailto:xolela@mac.com">xolela@mac.com</A> wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Within a snippet,  I am trying to prefix  the $TM_PROJECT_DIRECTORY  to a file name in applescript  (but I am not sure how TM environment variables &  files are concatenated into the applescript world?). </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">In essence,  the file textmatetostata.do is created   (from textmate)  by default in the  $TM_PROJECT_DIRECTORY.  The problem is that  when stata activates  it cannot find it - since it opens in a different directory by default. </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; ">What I am trying to do is as below: (but this is failing!)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">echo "$query" > textmatetostata.do</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">osascript -e "tell application \"Stata\"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">activate</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">open POSIX file   {<FONT class="Apple-style-span" color="#DF303D"><SPAN class="Apple-style-span" style="color: rgb(223, 48, 61); ">$TM_PROJECT_DIRECTORY} & </SPAN></FONT>\"textmatetostata.do\"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">end tell"</DIV></SPAN></BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Kevin Ballard</DIV><DIV><A href="http://kevin.sb.org">http://kevin.sb.org</A></DIV><DIV><A href="mailto:kevin@sb.org">kevin@sb.org</A></DIV><DIV><A href="http://www.tildesoft.com">http://www.tildesoft.com</A></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>