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
Oh! and bonus caveat - you have to have an actual text file open within the project window, as the document path is not set if you only have a folder open, and there appears to be no way to detect duplicates in that case.
--dan()
On 05/03/2010, at 13:26 , dan mackinlay wrote:
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. ...
On Mar 5, 2010, at 3:26 PM, dan mackinlay wrote:
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.
You don't need bash to run a script through osascript:
Also, I know I'm way behind on my mailing lists. ;)
-- Joshua P. Dady http://zzot.net/