[TxMt] Simple textmate applescripting question
wgscott at chemistry.ucsc.edu
Mon Aug 14 01:59:19 UTC 2006
On Mon, 14 Aug 2006, Allan Odgaard wrote:
> On 13/8/2006, at 5:02, William Scott wrote:
>> 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.
>> [...] 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.)
> The shell variables are only available from inside TextMate.
> You are not running this as a normal TextMate command?
That's right. I want to embed this in a shell script as an osascript.
Basically, if I could come up with something viable in Applescript like
"set ThePath to the POSIX path of the frontmost Textmate window"
I would be happy.
By analogy, this works for the Finder:
It returns the $PWD of the directory in the frontmost Finder window.
More information about the textmate