[TxMt] prefixing TM_PROJECT DIRECTORY in applescript

Kevin Ballard kevin at sb.org
Sun Dec 10 22:45:07 UTC 2006


query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
echo "$query" > textmatetostata.do

osascript -e 'on run(argv)
tell application "Stata"
activate
open POSIX file ((item 1 of argv as string) & "/textmatetostata.do")
end tell
end run' -- "$TM_PROJECT_DIRECTORY"

On Dec 10, 2006, at 5:05 AM, xolela at mac.com wrote:

> 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?).
>
> 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.
> What I am trying to do is as below: (but this is failing!)
>
> query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
> echo "$query" > textmatetostata.do
>
> osascript -e "tell application \"Stata\"
> activate
> open POSIX file   {$TM_PROJECT_DIRECTORY} & \"textmatetostata.do\"
> end tell"

-- 
Kevin Ballard
http://kevin.sb.org
kevin at sb.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20061210/057b2db3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2432 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061210/057b2db3/attachment.p7s>


More information about the textmate mailing list