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"
- thanks danstan
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@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"
Thanks Kevin,
However, sorry to bother you again.
I thought that the reference to "$TM_PROJECT_DIRECTORY" after end run' -- is what substituted for the (argv) in the run command. I am not getting any file to be opened. It appears that the line that does the concatenating is not working for some reason.
Thanks again.
danstan
On Dec 10, 2006, at 5:45 PM, Kevin Ballard wrote:
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"
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Oh sorry. replace the -- with a single -.
On Dec 11, 2006, at 1:27 AM, xolela@mac.com wrote:
Thanks Kevin,
However, sorry to bother you again.
I thought that the reference to "$TM_PROJECT_DIRECTORY" after end run' -- is what substituted for the (argv) in the run command. I am not getting any file to be opened. It appears that the line that does the concatenating is not working for some reason.
Thanks again.
danstan
On Dec 10, 2006, at 5:45 PM, Kevin Ballard wrote:
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"