Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have setup a System Preferences -> Keyboard -> Keyboard Shortcuts -> Services item to allow me to use a hotkey to "Open in TextMate". It works fine on files, but does not work on folders.

If I Control+Click on the same folder, select "Services" from the pop-up menu and choose "Open in TextMate" the folder is opened as a project in TextMate. This is exactly what I'm looking for. Is there a way to setup a shortcut to have the same open folder as project behavior as the Control+Click method?

share|improve this question
    
After seeing @Lri's answer I did a little more investigation. The keyboard shortcut did work for folder in any view other than column view in the Finder. I don't know if it's a bug or an intentional change, but I've seen multiple reports of the problem. –  Alan W. Smith Apr 26 '12 at 19:26
add comment

3 Answers

I think that's a bug with Finder. Services that receive folders as input don't seem to be listed in the Services menu when folders are selected (but it only applies to column view; they are listed in other view modes).

In any case, one alternative would be to just use an AppleScript without wrapping it as a service. You can give it an app-specific shortcut with FastScripts.

try
    tell application "Finder"
        open (get selection) using path to application "TextMate"
    end tell
end try
share|improve this answer
    
It does seem to be a bug in Lion's version of the Finder. The original shortcut I setup works in the other three Finder views that aren't column view. –  Alan W. Smith Apr 26 '12 at 19:27
add comment
up vote 1 down vote accepted

After seeing @Lri's answer I discovered that my original service would work in the Finder as long as I wasn't in column view. Since that's the view that I use most of the time, I decided to see if I could get @Lir's basic solution working without the need for an external application. Here's what I did:

  1. Open Automator and choose "Service" from the options of what to make.

  2. Set "Service receives" to "no input" and "in" to "Finder.app".

  3. Drop a "Run AppleScript" action onto the main window.

  4. Drop the code @Lri provided into place so you end up with:

    on run {input, parameters}
    
        try
            tell application "Finder"
            open (get selection) using path to application "TextMate"
            end tell
        end try
    
        return input
    end run
    

    enter image description here

  5. Save the action as "Open via TextMate".

  6. Under "System Preferences" -> "Keyboard" -> "Keyboard Shortcuts" -> "Services" -> "General" add my preferred shortcut to the "Open vie TextMate" item.

    enter image description here

This works in all my Finder views (including column view) for Mac OS X 10.7.3 and TextMate 1.5.10.

share|improve this answer
add comment

Looks like you can do this with a piece of software called Shortcuts.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.