Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

Open anything in TextMate via an AppleScript Apps
I modified the script in this hint to open the contents of the frontmost Finder window in TextMate's browse view. Here's the source, and the (very basic) installation and usage instructions are commented in the source.

Hope you find it useful!
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[5,196 views]  

Open anything in TextMate via an AppleScript | 6 comments | Create New Account
Click here to return to the 'Open anything in TextMate via an AppleScript' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Open anything in TextMate via an AppleScript
Authored by: vocaro on Wed, Nov 8 2006 at 10:15AM PST
I don't get it. What's the point of this script when you can just drag a file or directory from Finder and drop it onto the TextMate dock icon?


[ Reply to This | # ]
Open anything in TextMate via an AppleScript
Authored by: Madbob on Wed, Nov 8 2006 at 1:48PM PST
Because you can't open some things as a plain text document (i.e., textmate project files... textmate theme files etc.) An easy way to do the same thing is use terminal, mate ./file.ext will open the source of the file and not the project/theme.

---
http://www.rawkstar.net - music news and reviews

[ Reply to This | # ]

Open anything in TextMate via an AppleScript
Authored by: wgscott on Wed, Nov 8 2006 at 3:47PM PST
Here is a zsh shell script (or function) to cd to the directory displayed in the frontmost textmate window:
#!/bin/zsh -f

#  cdt

        DocPath="$(osascript -e 'tell app "TextMate" to return path of first document')" 
        DocDir="$(dirname "$DocPath")" 
        print "The frontmost TextMate file is $DocPath"
        fdc () {
                if [ -n "$1" ]
                then
                        if [ "${1%%/*}" = "" ]
                        then
                                thePath="$1" 
                        else
                                thePath="$(pwd)""/$1" 
                        fi
                else
                        thePath="$(pwd)" 
                fi
                osascript  /dev/null
                print "Changing Finder display to $DocDir"
                print "Current Working Directory remains $PWD"
        elif [[ $1 = "-F" ]]
        then
                command cd $DocDir
                fdc $DocDir > /dev/null
                print "Changing directory and Finder display to $PWD"
        else
                command cd $DocDir
                print "Changing directory to $PWD"
        fi




[ Reply to This | # ]
AppleScript not needed
Authored by: fooljay on Thu, Nov 9 2006 at 8:04AM PST
As excited as I was about this hint, I just realized that it's not even necessary. If you have the TextMate icon on your Finder window toolbar (and really, you should, because it allows you to simply drag-and-drop any file onto it to open in TextMate), all you have to do is drag the Finder window's proxy icon (the small one next to its name in the top menu bar) onto the TextMate icon. Ta-da! No AppleScript needed!

[ Reply to This | # ]
Open anything in TextMate via an AppleScript
Authored by: haguremetaru on Sun, Nov 12 2006 at 6:43PM PST
But then again, you can save this script as an application, then us QS' "Open With.." command for a quick keyboard-only approach.


Sharing is caring! Thanks OP.

[ Reply to This | # ]
Open anything in TextMate via an AppleScript
Authored by: Skurfer on Fri, Nov 17 2006 at 8:17AM PST
You don't need to save anything to do this in Quicksilver. It'll work "out of the box". Just hit
⌘⎋ ⇥ ow ⇥ tm ↩
In case those characters don't come through correctly, that was
Command-Escape, Tab, ow, Tab, tm, Return
I don't have Front Row, but I think it uses Command-Escape, so in that case, you can just bring up Quicksilver the usual way and hit ⌘G (Command-G). Enjoy!

[ Reply to This | # ]