Since the stata bundle,  to run selections of text , uses  a temp do file (that it places in the project directory by the current formulation, if the working directory in stata is not the TM  project directory, it cannot find the file and does  not run (unless I manually do a "cd TO THE  TM_PROJECT FILE" manually within stata).   This must be simple to crudely automate -  I wanted to further  modify  Tim's  trigger  applescript that is running this file  by  prefixing it with the $TM_PROJECT_DIRECTORY  (but I am not sure how environment variables &  files are concatenated in the applescript world?) as in 

echo "$query" >

osascript -e "tell application \"Stata\"
open POSIX file   {$TM_PROJECT_DIRECTORY} & \"\"
end tell"

Otherwise, I would appreciate any other  elegant solution. (I should note that within stata the working directory is set  by the menu dialogue  item  triggered by  shift-apple-j in case one would take that route).  

thanks in advance


On Sep 1, 2006, at 3:06 AM, Timothy Beatty wrote:

Thanks for the feedback,


The only way I've been able to figure out to run selections is to save
the selection to a temporary file and run the temporary file.  Alan
suggested saving the file in /temp/, rather than in the
current working directory.  I think that makes sense and will give it
a bid.  I looked at the R bundle's implementation of running a
selection, and as best I could tell (not very well, granted) it relies
on some AppleScript that Stata doesn't recognize.  Simply stealing the
R implementation was my first instinct, but I couldn't get it to work
(which doesn't mean, it can't work, just that I couldn't get it to


Thanks for the suggestions, I think I'll probably use both of them,


For new threads USE THIS:
(threading gets destroyed and the universe will collapse if you don't)