Simple textmate applescripting question ([TxMt] TermMate bug)

Allan Odgaard throw-away-1 at macromates.com
Tue Oct 31 18:51:09 UTC 2006


To get the full path of the first document, you can run:

     osascript -e 'tell app "TextMate" to return path of first document'

I reckon it is easier to call dirname on that, than to try and make  
AppleScript split it up. E.g.:

     dirname "$(osascript -e 'tell app "TextMate" to return path of  
first document')"



On 31. Oct 2006, at 19:45, William Scott wrote:

> Hi Bill:
>
> I was hoping for something similar when I wrote to the mailing list  
> a couple of months ago.  If $TM_DIRECTORY could be made available  
> to the outside world via applescript, morons like me could make use  
> of this.
>
> If he does let you hack on it, I'd be grateful for this  
> functionality too.
>
> Thanks.
>
> Bill
>
> PS:  What I have in mind is something similar to Gary Kerbaugh's  
> Terimal/iTerm -- Finder interaction osa/shell scripts:  http:// 
> xanana.ucsc.edu/xtal/terminal_finder_interactions.html
>
>
> William G. Scott
>
> contact info:  http://chemistry.ucsc.edu/~wgscott
>
>
>
>
> Begin forwarded message:
>
>> From: William Scott <wgscott at chemistry.ucsc.edu>
>> Date: August 12, 2006 8:02:30 PM PDT
>> To: textmate at lists.macromates.com
>> Subject: Simple textmate applescripting question
>> Reply-To: wgscott at chemistry.ucsc.edu
>>
>> Hi:
>>
>> I am trying to write a simple osascript command-line utility that  
>> acquires the directory of the file displayed in the frontmost  
>> TextMate editor window, and am having trouble.
>>
>> I've been trying to use applescript syntax such as this:
>>
>> osascript<< END
>> tell application "TextMate"
>> 	activate
>> 	do shell script "echo $TM_DIRECTORY"
>> end tell
>> END
>>
>> but the variable $TM_DIRECTORY is apparently empty.
>>
>> Is there another way to accomplish this, with or without  
>> applescripting? (I'd prefer a less pathological scripting language.)
>>
>> Thanks.
>>
>> Bill
>>
>>
>>
>>
>>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list