Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[8,400 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 whoever posted them. This site is not responsible for what they say.
Open anything in TextMate via an AppleScript
Authored by: vocaro on Nov 08, '06 10:15:19AM

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: RawkBob on Nov 08, '06 01:48:24PM
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 Nov 08, '06 03:47:37PM
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 Nov 09, '06 08:04:11AM

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 Nov 12, '06 06:43:24PM

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 Nov 17, '06 08:17:32AM
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 | # ]