Launchbar and TextMate environment variables

Sharing and discussing custom actions for LaunchBar
Post Reply
apc
Posts: 3
Joined: Wed Aug 04, 2010 6:21 pm

Launchbar and TextMate environment variables

Post by apc » Wed Aug 04, 2010 6:26 pm

Hi,

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?

Thanks,

APC

Cottser
Rank 1
Rank 1
Posts: 21
Joined: Fri Jan 22, 2010 2:57 am

Re: Launchbar and TextMate environment variables

Post by Cottser » Fri Aug 20, 2010 6:28 am

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!

Post Reply