More OSX Tips and Tricks

Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information.

A few quick tips for integrating some of the OSX apps I’ve been talking about lately.

First of all, it’s really handy to have icons on every Finder window for launching your most used apps for different files. I have icons for TextMate, CSSEdit, Terminal and a shortcut that selects files of the same type as the selected file in the window. You create these buttons using the following steps:

Icons in Finder1. Create an Applescript that launches the application using the current selection or folder, and/or performs certain commands on it.

2. Save the Applescript as an application in ~/Library/Scripts/Applications/Finder. If the directory structure doesn’t exist, create it. I find it easiest to do this using Terminal, but you can do it just find in Finder.

3. Use CMD-I to open the info window for the script. Find the associate application and open its info window as well. By clicking on the icon at the top left of the app info window, you can highlight the icon and copy it (CMD-C). Click the icon in the scripts window and paste (CMD-V). Close the info windows.

4. Drag the newly iconified script to the top of the finder window and move it around until you see a rectangle outline appear. Releasing it at that point will drop it into the window, and it will now show up in all of your windows. It’s behavior will be determined by the Applescript.

A couple of quick scripts for you:

Open Current Folder in Terminal

on run {input, parameters}

	tell application "Finder"
		set myWin to window 1
		set theWin to (quoted form of POSIX path of (target of myWin as alias))
		tell application "Terminal"
			activate
			tell window 1
				do script "cd " & theWin
				-- do script "cd " & theWin & ";ls -al | more"
			end tell
		end tell
	end tell

	return input
end run

Open selected file(s) in CSSEdit

on run
	tell application "Finder" to set myFiles to the selection
	repeat with aFile in myFiles
		tell application "Finder"
			using terms from application "Finder"
				tell application "CSSEdit"
					open (aFile as alias)
				end tell
			end using terms from
		end tell
	end repeat
end run

Select Same File Type in Current Window

	try
	tell application "Finder" to set the source_folder ¬
		to (folder of the front window) as alias
	on error
		beep
	end try

	tell application "Finder"
		set selectionList to {} & selection as list
		set selectedCount to count items in selectionList

		if selectedCount > 0 then
			set nameExtension to name extension of item 1 in selectionList
			select (every item where name extension ¬
				is nameExtension) of (folder source_folder)
		end if
	end tell

You can find a script to add TextMate to the Finder over at bigbold.com.

Quicksilver

Quicksilver is a key ingredient that I neglected to mention yesterday. It is a launcher that works with your keyboard instead of your mouse (although it now supports mouse gestures). I liked it before I discovered TextMate, but now that my coding is so completely keybaord based, it’s great to have a launcher that is too. And with a minimal amount of effort, you can add the entire bundle menu from TextMate into Quicksilver. One thing to note, you have to install the User Interface Access plugin before “Show Menu Items” will appear.

Quicksilver provides hotkey access to both applications and files, as well as menus, settings, macros, and more, from anywhere on your mac. That means you can store information in its shelf, or use it for quick access to ftp servers, easy launching of a color guide or graphics manipulation program while you’re coding, etc. It’s indispensable. And it’s free. Not sure I mentioned that ;-).

Next Time

Next time, I’ll be looking at some intermediate Ruby programming to get some more juice out of the Wikipedia Linking command. It’s nice, but not nearly complicated enough yet. Stay tuned.

» » » » »

Comments are closed

Comments are currently closed on this entry.

Comments are closed.