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 tell
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 tell
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.
Pressing Option-Space pulls up the full-screen Quick Look view in Finder under Snow Leopard. This may be documented somewhere, but I haven't been able to find it.
[robg adds: It's documented if you hold down the Option key and look at the File menu. With the Option key down, Quick Look (selection) becomes Slideshow (selection).]
After I installed 10.6 on a couple of my Macs, I had problems only with my (current generation) Mac Mini that is connected to a Dell television. I could not get any video after rebooting, turning off the TV, etc.
Since I have multiple Macs, I connected to the Mac Mini via Screen Sharing and went to the System Prefs » Display panel, and selected my previous resolution setting. This made the video work right away.
Without a second Mac, I have no idea how someone could fix a problem like this.
[robg adds: This should work for any installation that selects an invalid resolution.]
Have you ever tried to eject a CD or DVD and were told that the disk was in use and couldn't figure out what was using the disk? After helping others answer this question, I created this shell script to provide the answers.
#!/bin/bash
PATH=${PATH}:/sbin:/usr/sbin
dr=($(drutil status | grep -i 'type:'))
devtype=${dr[1]}
device=($(mount | grep ${dr[3]}))
if [ $devtype = "No" ]
then echo No disk found. Sorry! >&2
exit 1;
fi
echo A $devtype is mounted on the device named $device
pids=($(sudo -p 'Please enter the administrator password:' lsof -t $device))
echo \nList of programs that may be preventing the disk to eject
ps -o pid,user,comm=COMMAND -www -p $(echo ${pids[*]} | sed 's/ /,/g')
The output is a list of the processes that lsof says is using the CD or DVD. You can probably plug this into GeekTool or some other GUI assist program; I just use the terminal.
[robg adds: Snow Leopard should provide this information automatically, so I marked this one as 10.5 only (though it probably works on 10.4, too). I tested on my 10.5 machine, and it seemed to work (though I didn't have a busy CD/DVD at the time of testing). Remember to make the script executable (chmod a+x script_name).]