Add columns to Spotlight search results

A major complaint about Snow Leopard is that you cannot add the Size column to Spotlight search results window. This is the window that you get by choosing “Show All” in Spotlight or by pressing Command-F in the Finder. When you go to add columns to it by choosing “Show View Options” from the View menu, you’ll find that Size, Comments, Version and Label are all greyed out.

Search View Options

These options used to be available in previous versions of Mac OS X, so it’s unusual that they are now disabled. You might assume that Apple disabled these columns for a reason, so bear this in mind before following these instructions to enable them again.

If you have the developer tools installed, you can enable the columns again using the included Property List Editor. If you don’t already have the developer tools then it’s not worth installing them for such a small task. Instead, you can download and use TextWrangler (free) instead.

Using Property List Editor

If you are using Property List Editor, start by going to your user folder and then navigate to Library/Preferences. In the Preferences folder find the file named “com.apple.finder.plist.” Double-clicking on this file should open it up in Property List Editor. If not, just right-click on it and choose “Open With - Property List Editor.”

Once the file is open, scroll down the list to “SearchViewSettings.” Click the disclosure triangle next to it, and then do the same for “ListViewSettings” and then “columns.” Now you should see a list of all the available columns. Click the triangle next to the column you want to add, i.e. size, and then check the box next to “visible.”

Finder plist Edit

Once you are done, save the file by pressing Command-S. Finally, you will need to restart the Finder for the changes to take effect. The easiest way to do this is top hold down the Control and Option keys, click on the Finder icon in the Dock and choose “Relaunch.”

Now just press Command-F to bring up a search window and you should have your extra columns enabled.

Using TextWrangler

With TextWrangler, the process is very similar, but just a tiny bit more complicated. Firstly, make sure you have downloaded and installed TextWrangler. Next, go to your user folder and then navigate to Library/Preferences. In the Preferences folder find the file named “com.apple.finder.plist.” Right-click on this file and choose “Open With - TextWrangler.” Once the file is open, you want to find the line that says
<key>SearchViewSettings</key>

Don’t bother scrolling through the file looking for it - for me it is on line 4973! Instead, just press Command-F and type “SearchViewSettings” into the find field. Once you have found the line, look about 8 lines below it. You should see something like this:
<key>comments</key>
<dict>
	<key>ascending</key>
	<true/>
	<key>index</key>
	<integer>8</integer>
	<key>visible</key>
	<false/>
	<key>width</key>
	<integer>196</integer>
</dict>
This should then be followed by a similar 11 lines for each of the other possible columns. Find the one you want to enable (Size, Comments, Version or Label) and look for this:
<key>visible</key>
<false/>
Replace this with:
<key>visible</key>
<true/>
and you’re done! Just save the file by pressing Command-S, then restart the Finder by holding down the Control and Option keys, clicking on the Finder icon in the Dock and choosing “Relaunch.”

Added Search Columns

|

The Input menu and Character Viewer

The input menu is a handy little menu extra that appears on the right hand side of the menu bar. While its main use is for switching between the keyboard layouts of different countries, it’s also really useful for quickly typing special characters.

Input Menu

To enable the menu, open up System Preferences and go to the Language and Text section. Under the “Input Sources” tab, check the “Show Input menu in menu bar” option at the bottom.

Language and Text Preferences

By default your input menu will be pretty empty. Most likely there will be one input method that matches your own country or language. To add items just choose them from the list in the Language and Text Preferences. Each of these input sources is essentially a different keyboard layout, with some extra complexities for non-latin alphabets. The best way to understand how they work is to enable a few, then switch between them using the input menu. Then go to an application like TextEdit and do some typing.

There is a handy keyboard shortcut that allows you to quickly switch between your input sources, but on some Macs it seems to clash with Spotlight. You can resolve this clash in the Keyboard section of System Preferences, for example by setting Spotlight to Command-Space and the input switcher to Control-Space. The input switcher works just like the Command-Tab application switcher. If you keep the control key held down, a menu will appear that allows you to tap the space bar to cycle through the different input sources.

Input Switcher

If you only ever type in one language, being able to switch between input sources isn’t of much use for you. However the input menu is also great for quick access to special characters. To do this, enable the Keyboard & Character Viewer, which is at the top of the input sources list.

Now whenever you find yourself wanting a special character, you can just quickly go to the input menu and choose “Show Character Viewer.” Every single character that your Mac is able to produce is available in this window, including punctuation, mathematical symbols and other alphabets. The quickest way to find the character you are looking for is to start typing its name into the search box at the bottom. Once you have found your chosen character, you can either drag it into where you are typing, or click the “Insert” button.

Character Viewer

You may notice that if you have only one input source and the Keyboard and Character Viewer enabled, the input menu icon changes to the Keyboard & Character Viewer icon instead of the flag of your chosen input source. If you want the flag back, you will have to add at least one other input source to the menu (even if you never switch to it).

There are a couple of input sources that may still be useful, even if you only use one language. American users may find the US Extended layout is better for typing diacritics using the Option key. Scientists and mathematicians may find that using the Control-Space keyboard shortcut to switch to the Greek input source is quicker than opening up the Character Viewer when adding Greek letters to equations. The Unicode Hex Input source is also a great way for quickly typing special characters. To use it you just hold the Option key and type four hex digits (numbers 1-9, letters a-f), but of course this requires that you remember the 4-digit hex code for the symbols you want to type.

If the Character Viewer is the only thing in the menu you find interesting, you may want to disable the input menu and use another method for opening the Character Viewer. In many applications it is accessible from the bottom of the Edit menu, under “Special Characters,” often with the keyboard shortcut Command-Option-T. Alternatively, the application itself is located in /System/Library/Input Methods/CharacterPallette. You can easily drag this to the Dock or Finder sidebar.

To create a keyboard shortcut for it, open up Automator (in the Applications folder) and create a new Service. Add the “Run Applescript” action, and paste the following lines in:
tell application "CharacterPalette"
	activate
end tell

Change the “text” drop-down menu to “no input,” then save the Service. You can then add the keyboard shortcut from the Keyboard section of System Preferences.

|

Quickly enable Private Browsing

Normally when you are browsing the internet, Safari keeps a record of things like the pages you have visited, the files you have downloaded and the searches you have made. In most circumstances this is great as it can save time and help you retrace your steps. However, in some cases you may prefer to leave no record of your browsing, for example when you are using a public computer.

Safari’s Private Browsing mode is great for this. Just go to the Safari menu and choose “Private Browsing.” Click OK in the dialog box that appears and then you are browsing privately. Safari won’t store the sites you visit in the History menu, and your Google searches won’t be added to the Recent Searches menu.

Safari Private Browsing

Enabling and disabling Private Browsing through the Safari menu can be a bit annoying, especially if you find yourself doing it often. Luckily there are a couple of ways to speed this up.

In all menus in Mac OS X, an item followed by an ellipsis (…) means that action will be followed by a dialog box. If you hold down the Option key while the Safari menu is open, you will notice that the ellipsis after Private Browsing disappears. Now when you click it, you will skip the dialog box. This is a great trick for skipping the “Are you sure?” type dialog boxes in any Mac OS X application.

When Private Browsing is enabled, a “Private” button will appear the in address. Just click this button to quickly exit Private Browsing mode and return to normal browsing. This also has an “Are you sure?” dialog box, but Option-clicking it will skip it in a similar way.

Private Button Address Bar

You can also create a keyboard shortcut that does the same thing. Open up System Preferences and go to the Keyboard section. Under the Keyboard Shortcuts tab, click the “Application Shortcuts” item at the bottom of the list on the left.

Now click the plus (+) button to add a new shortcut. Choose Safari from the Application drop-down menu, and type “Private Browsing” into the Menu Title field. Make sure you don’t add the ellipsis (…) unless you still want the dialog box to pop up. Finally, choose your keyboard shortcut. I use Command-Shift-P.

Private Browsing Shortcut

Now when you return to Safari, there should be a new Private Browsing item in the Safari menu, without the ellipsis and with your chosen keyboard shortcut next to it. Pressing these keys should quickly toggle Private Browsing on and off without you dealing with dialog boxes or having to go to menus.

|

Official Apple Safari Extensions gallery goes live

Just a quick note to say that the official Safari extensions gallery is now live on the Apple site, and Safari 5.01 is available via Software Update. Note that if you visit the extensions gallery with an older version of Safari, you won’t see any of the download links.

There are a few extensions by Mac OS X Tips included, but it seems Apple are being quite picky and have only included a small selection of all the extensions that are out there.

You can view and download all of the Mac OS X Tips extensions over on our extensions page.

Screen shot 2010-07-28 at 15.32.36 Screen shot 2010-07-28 at 15.34.05

|

Automatically set time zone by location

Snow Leopard has the ability to automatically set your time zone based on your location. To enable this, go to System Preferences and click on the “Date and Time” section. Under the Time Zone tab, check the “Set time zone automatically by location” option. The map should become greyed out, and your Mac should determine your current location using CoreLocation.

Time Zone CoreLocation

Generally your Mac won’t have GPS, so instead this works by checking the visible Wi-Fi networks against a database of their locations. As a result this only works when your AirPort is turned on, but it isn’t necessary for you to be connected to the internet through it. Of course this also works much more accurately in urban areas where there are lots of Wi-Fi networks around.

If you have connected a GPS device to your Mac and it is recognised by Mac OS X, CoreLocation should switch over to using that. This means that having nearby Wi-Fi networks is not an issue, but you do need to make sure you have GPS signal.

Now when you travel with your Mac, the time zone should automatically update to your new location.

Other applications can also use CoreLocation. For example, Google Latitude asks for access to your location so it can share it with your friends. While an application must always ask your permission for access to your location information, some people still see this as a bit of a privacy and security risk. To disable CoreLocation completely, go to the Security section of System Preferences and check the “Disable Location Services” checkbox under the General tab.

Disable Location Services


|

Bulk edit Address Book contacts

Unfortunately Address Book doesn’t support bulk editing a large number of contacts at once, but there are a couple of clever workarounds to achieve the same effect. Here are two different methods, the first using TextEdit and the second using AppleScript.

Manually editing a vCard file

This method is great if you have a group of people who share the same information. For example, if you have a whole load of people at the same address, and they have all moved to a new address, or if a group of people share a phone number and they recently changed it to something new.

The first thing to do is to make a backup of your Address Book. Open up Address Book and choose Export - Address Book Archive from the File menu. If anything goes wrong in the following process, you can always just find this file and double-click it to restore your original Address Book.

Next, create a contact group by clicking on the plus (+) icon in the bottom left. Add all of the contacts you want to bulk edit into this group by dragging their names across from the contact list. Once this is done, drag the group from Address Book onto the Desktop to create a single .vcf file that contains contact information for everyone in the group.

The next step is to open this .vcf file with TextEdit. Either open TextEdit and choose “Open...” from the File menu, or just drag the .vcf file onto the TextEdit icon in the Dock. Now we are going to use TextEdit’s Find and Replace feature to find the existing information and replace it with the new information.

Choose “Find...” from the Edit menu or press Command-F. In the “Find” text field, enter the old information, such as the old address or phone number. You might have to look in the file to see how this is formatted. For example, addresses have semicolons to separate lines like
item2.ADR;type=HOME;type=pref:;;8 High Street;Earls Court;London;SW5 9EK;UK
Press the Next button a few times to check that it is entered correctly, then enter the new information in the “Replace with” field. Now just click the “Replace All” button and every instance of the old information should be replaced with the new information. Check the file to make sure it looks correct, and then save it.

Find and Replace

Finally, go to the Desktop and double-click on the .vcf file to import the contacts back into Address Book. You will be warned that the contacts are duplicates and will be updated. If you want, you can click “Review Duplicates...” to check that the changes are correct, or you can just click Import.

Using AppleScript

This second method is actually more flexible, but it does require that you get familiar enough with AppleScript to create your own script or modify one of my examples to suit your needs.

Start by opening up AppleScript Editor (located in Applications/Utilities). This is called Script Editor and is located in Applications/AppleScript if you are using Leopard or earlier.

Copy and paste the following lines into the AppleScript Editor window, and click the Compile button. If the AppleScript has been entered correctly, you should receive no errors.
tell application "Address Book"
    set peopleToChange to people whose (street of first address) contains "321 Old Street"
    repeat with thePerson in peopleToChange
        set (street of first address) of thePerson to "123 New Street"
    end repeat
    save
end tell

One of the great things about AppleScript is that it is designed to be readable by someone who knows nothing about AppleScript. Here’s a walk through what the above script does.

The first line says that we are about to tell Address Book to do something. The second line finds all the people in your address book whose street of their first address (people can have more than one address) contains “321 Old Street.” It then stores a list of all these people under the name peopleToChange. The third line says that we are going to go through the list peopleToChange one item at a time, and we will refer to each item in the list as thePerson. The next line sets the street of the first address of thePerson to “123 New Street.” Then the fifth line says we are finished going through the list peopleToChange, the sixth line saves the changes, and the last line says we are finished telling Address Book to do something.

You will have to create your own AppleScript to fit your exact needs, but the general structure of it will be similar to the above example. When you have created the script you want to use, just press the Run button to run the script and make the changes. Included below are a few more example scripts.

Change every occurrence of phone number “020 6704 3205” to “020 1523 6843.”
tell application "Address Book"
    repeat with i from 1 to (count every person)
        set phoneProperties to properties of phones of person i
        repeat with j from 1 to (count of phoneProperties)
            if value of item j of phoneProperties contains "020 6704 3205" then
                set value of item j of phones of person i to "020 1523 6843"
            end if
        end repeat
    end repeat
    save
end tell

Clear the Notes field for every contact
tell application "Address Book"
    repeat with i from 1 to (count every person)
        set note of person i to ""
    end repeat
    save
end tell

A more advanced address replacement script
tell application "Address Book"
    repeat with i from 1 to (count every person)
        set theAddresses to properties of addresses of person i
        repeat with j from 1 to (count of theAddresses)
            if street of item j of theAddresses contains "321 Old Street" then
                set street of item j of addresses of person i to "123 New Street"
                set city of item j of addresses of person i to "NewCity"
                set zip of item j of addresses of person i to "12345"
                set country of item j of addresses of person i to "USA"
            end if
        end repeat
    end repeat
    save
end tell

Replace “@googlemail.com” in email addresses with “@gmail.com”
tell application "Address Book"
    repeat with i from 1 to (count every person)
        set theEmailAddresses to properties of emails of person i
        repeat with j from 1 to (count of theEmailAddresses)
            if value of item j of theEmailAddresses contains "@googlemail.com" then
                set oldAddress to value of item j of theEmailAddresses
                set AppleScript's text item delimiters to {"@"}
                set firstBit to first text item of oldAddress
                set newAddress to firstBit & "@gmail.com"
                set value of item j of emails of person i to newAddress
            end if
        end repeat
    end repeat
    save
end tell

You can find more information about AppleScript in Address Book by going to “Open Dictionary...” in the File menu in AppleScript Editor and choosing Address Book from the list.

|