Since (apparently) later versions of 10.5, Spotlight has a file called VolumeConfig.plist which you can edit to index only certain directories. For example, I wanted to index only my Mail folder and my Documents folder because those don't usually have radical changes, and they're the only places I ever need search (especially Mail). To accomplish this, I first disabled Spotlight indexing on my hard disk:
sudo mdutil -i off /
Then, with root permissions, I opened /.Spotlight-V100/Store-V1/VolumeConfig.plist and edited it. I changed partialPath to Users/myusername/Library/Mail (note the lack of a leading slash), and policySearch to 3.
You can also copy the whole block describing the index (it has a long UUID string for its key, and then the dictionary that goes with it describes partialPath and policySearch), and change the UUID (use uuidgen in Terminal) to add additional paths that you want indexed. When you're done, save changes to the file, then restart mds:
sudo launchctl stop com.apple.metadata.mds
Now that you've set up the new indexes, you should be able to control them using mdutil:
mdutil -sv ~/Library/Mail
Use caution however, as you may undo your work if you run mdutil -i on /.
Just thought I'd throw a little PowerPC love into the mix so we don't feel left out with all the Snow Leopard hints dominating lately.
On my G4 Powerbook, occasionally the Dock won't come out of hiding; it's stuck and unresponsive. I got tired of having to open Terminal or Activity Monitor to kill it, and ever since I installed Leopard, I don't use Dashboard any more (where I always had the killDock widget ready for numerous reasons - particularly to kill the Dashboard processes) because it's too slow on this machine. So I looked for a faster way to get the Dock to respond again. I always have the Displays menu bar item showing, so I tried selecting Detect Displays from and voilà, the Dock suddenly became unstuck.
I'm not sure what's causing the unresponsiveness, but I seem to be pushing the limit of this PowerBook lately, and with a DLP always attached but not always powered on, the displays often get stuck in dual mode, and some windows are hidden in a non-existent space. Detect Displays fixes that as well. Perhaps this is also affecting the Dock.
As noted in this discussion (and related threads) at Apple Discussions, as of the 10.5.5 Combo Update, the Location Manager no longer remembers the AirPort on/off state when switching between locations. Also, when one switches to a Location where AirPort is inactive (not just off), AirPort is turned off, so switching back to a Location where AirPort is active requires an extra step to turn on AirPort.
I have written AppleScripts that can change network locations while also turning on AirPort and also switching Location in DAVE Networking and enabling Internet Sharing for some Locations. The specific code just for the Network pane to change Location and enable AirPort is as follows. This code sets the Location to one named Home and turns on AirPort.
A tidbit for people who like Folder Actions. The System Events app (a faceless background app that allows AppleScript to work with system functions) has a suite for working with folder actions which lets you add, remove, or enable/disable scripts on particular folders on the fly. For instance, say that you have a dropbox folder with an attached folder action to modify files when they are added or removed, but you want to be able to open the folder and add/remove files directly without the script being triggered.
Save the following two subroutines as a script, and attach it to the folder along with your other script (of course, change other script to the name of the other script that runs on the folder):
on opening folder thisFolder
tell application "System Events"
set enabled of (script "other script" of folder action thisFolder) to false
end opening folder
on closing folder window for thisFolder
tell application "System Events"
set enabled of (script "other script" of folder action thisFolder) to true
end closing folder window for
Opening the folder in the Finder will now disable the other folder action script until you close the folder window again.
Have you ever received a text file that contains a lot of data you'd like to analyze? Rather than copy-and-paste it, item by item, into your spreadsheet app, here's another solution. In my case, I wanted to look at Apple's downloaded application stats for iPhone Developers. Unfortunately, there are in an ugly pure text format. To make them more useful, open then in TextEdit and convert them to CSV files. This is relatively easy to do:
Find a tab character in the file. This isn't too hard to do, because that's how info is separated. Make sure it's only one tab and not two tabs. Copy the character. (Alternatively you could open up any new document, type a tab character, and copy it.)
Open Find and Replace (Command-F). For the Find value, paste the tab character. You must paste it, as typing Tab jumps to the next field. Set the Replace vale to a comma (,).
Hit Replace All. You'll see plenty of places where there are now multiple commas (especially with Daily reports). Ignore this; everything will be fine.
I use Save As mostly as a precaution, but Save will work. All you need to do is change the extension to .csv for Comma Separated Value. If no extension is showing, type it on you own. When prompted, say that you do want to use CSV as the format.
Open the CSV file in Numbers or Excel, etc. Not only is the layout nice, but you can now run math functions on the data, if that's your thing.
Unfortunately, download stats files don't come like this, but it's only a few seconds per file. Also, you could potentially write an Automator/AppleScript solution to handle the work.
[robg adds: Excel is pretty good at parsing many pure text files, so you could also try asking Excel to simply open the downloaded file first, to see what you get.]
In the Bluetooth System Preferences panel, if you option-click on a device in the left-hand side of the window, you'll see more detailed information about that device on the right-hand side of the window. This is the same information you'll see if you select the device, click the Action (gear) icon at the bottom of the window, and choose Show More Info from the pop-up menu.
Also, if you open the Bluetooth System Preferences pane while holding down the Option key, it will default to the Show More Info display for the last-selected device.
[robg adds: Holding down the Option key is much simpler than using the contextual menu. This works in at least 10.5 and 10.6; I'm not sure about 10.4.]
Command-Tab is a known shortcut that allows switching between applications. Press and hold Command, then press and release Tab (while holding Command), and OS X will show a strip of large app icons across the screen, letting you easily switch applications by pressing Tab (forward), tilde/backquote (backward), the mouse, or many other methods.
But say you are switching between one of your Safari windows and a specific Pages document, or whatever, and you don't need to see the app switcher every time. You can switch back and forth between them without seeing the app switcher. To do so, press and release Command and then Tab quickly, making sure you press Command first.
When done right, you won't even see the app switcher icons; you'll simply flip between the last two programs you've used. This is useful when you have lots of windows open, and every time you select one application, its windows cover other apps' windows.
[robg adds: This works in 10.5 and 10.6, and perhaps even 10.4. I thought we had covered it in a prior hint, but I couldn't find it when searching. If you find it's a duplicate, please let me know.]
I often use the calculator feature built into the Spotlight menu. When doing numerous calculations, I often wish the Clear key on an extended keyboard with a number pad would clear the already-entered text. Alas, 10.6 doesn't enable this. But here's what I discovered:
In 10.4, 10.5 and 10.6, you can use Option-Delete to clear the last word. In both 10.5 and 10.6, Command-Delete will clear all text already entered in the Spotlight menu (as will pressing the Escape key).
This recent hint points out that the old strings approach to inspecting applications doesn't work for finding hidden preferences in Snow Leopard. I've worked out a way that works for the Finder, but it may not work with other applications (eg. I didn't have much luck with the Dock). In order to use this hint, you'll need to have the Xcode developer tools installed.
First, quit Finder. This can be done via AppleScript, or by enabling the Quit menu item in the Finder. After that, open a Terminal window (make sure it's in your Dock or running before you quit Finder). Then type:
$ cd ~/Desktop
$ gdb /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
This loads gdb (the GNU debugger) and gets it ready to debug the Finder. You can actually attach gdb to a running copy of the Finder, but (a) you need to be root, and (b) you'll miss all the lovely prefs the Finder asks for when it starts up, so you may as well start fresh.