<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi TextMate folks.</div><div><br></div><div>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.</div><div><br></div><div>Script is up here:</div><div><a href="http://gist.github.com/322512">http://gist.github.com/322512</a></div><div>Comments and criticism appreciated. Please feel free fork it and make your own modifications and improvements if it is useful to you.</div><div><br></div><div>Caveats:</div><div><br></div><div><ul class="MailOutline"><li>I'm no Applescript ninja - in fact this is my first, learn-by-doing <a href="http://foray.It">foray.It</a> should be clear that I have been working out variable scoping by trial and error. Tidying could happen.</li><li>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 <a href="http://lists.macromates.com/textmate/2009-March/028352.html">http://lists.macromates.com/textmate/2009-March/028352.html</a></li><li>If you run it using a path such as "." or ".." instead of an absolute path, textmate will hang. Not quite sure why.</li><li>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</li></ul></div><div> </div><div>Have fun,</div><div>Dan</div></body></html>