Hi TextMate folks.
I've written a little applescript to do what I regularly need to do - open a folder in TextMate if and only if it's not already open, from the command-line. (I have command-line scripts to set up my workspaces for each project for me.) Is there another way to do it? Not that I could see, although it's tricky to keywords-search that one. I kind of feel it should be a command-line option to the "mate" command.
Script is up here: http://gist.github.com/322512 Comments and criticism appreciated. Please feel free fork it and make your own modifications and improvements if it is useful to you.
Caveats:
I'm no Applescript ninja - in fact this is my first, learn-by-doing foray.It should be clear that I have been working out variable scoping by trial and error. Tidying could happen. The entire section to bring the window that contains your folder of choice to the front is broken - there seems to be no way to get between window objects and document objects despite what the Applesscript dictionary says, as noted by Alan Watson http://lists.macromates.com/textmate/2009-March/028352.html If you run it using a path such as "." or ".." instead of an absolute path, textmate will hang. Not quite sure why. I've assumed you are trying to open a folder rather than a file, and that opening a parent of said folder counts as that folder being already open
Have fun, Dan