Page 1 of 1

Launchbar and TextMate environment variables

Posted: Wed Aug 04, 2010 6:26 pm
by apc

TextMate has some handy environment variables that I'd like to use in a custom script. For example, if I run the script

echo Directory: "$TM_DIRECTORY"

I will get the expected outcome. ($TM_DIRECTORY will be replaced with the enclosing folder of the file I'm working on when I run the script.)

Does anyone know if there is a way of sending the value of those variables to Launchbar?



Re: Launchbar and TextMate environment variables

Posted: Fri Aug 20, 2010 6:28 am
by Cottser
It's hard to say without knowing more detail, but with the example you've given, that could be accomplished through AppleScript.

Quick and dirty example:

Code: Select all

tell application "TextMate"
   set docPath to the path of document 1
   display alert docPath
end tell

Of course, this example will give you the full path including the file name, but you could manipulate the docPath string to remove the file name if needed.

I'm not familiar with TextMate's environment variables, but in most cases AppleScript might actually be more reliable, many of the variables say "may not be set", and I certainly found that to be the case while doing some rudimentary testing.

Hope that's of some use to you. Happy scripting!