Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Index only certain directories in Spotlight System
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 /.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (1)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (9 votes cast)
 
[6,038 views] Email Article To a Friend View Printable Version
A possible quick fix for an unresponsive Dock System
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.
  Post a comment  •  Comments (3)  
  • Currently 1.57 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[8,197 views] Email Article To a Friend View Printable Version
Use AppleScript to turn on AirPort and networking System
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.
tell application "System Preferences"
  activate
  set current pane to pane "com.apple.preference.network"
end tell

tell application "System Events"
  tell process "System Preferences"
    -- delay 1
    -- click menu item "Network" of menu "View" of menu bar 1
    if my wait4window("Network") is false then return false
    tell window "Network"
      click pop up button 1
      click menu item "Home" of menu 1 of pop up button 1
      delay 2
      if (exists window "Confirm Access to Keychain" of process "SecurityAgent" of application "System Events") then
        click button "Always Allow" of group 1 of window "Confirm Access to Keychain" of process "SecurityAgent" of application "System Events"
        -- delay is apparently not needed
      end if
      click button "Apply"
      if my wait4window("Network") is false then return false -- window can be inaccessible for a time
      if my wait4disabled(button "Apply") is false then return false
      if (exists sheet 1) then
        click button "OK" of sheet 1
      end if
      repeat with myRow in (rows of table "Services" of scroll area 1)
        get value of static text of myRow as string
        if (offset of "Airport" in result) is not 0 then
          select myRow
          if button "Turn AirPort On" of group 1 exists then
            click button "Turn AirPort On" of group 1
            repeat with i from 1 to 60
              if button "Turn AirPort Off" of group 1 exists then exit repeat
              delay 1
            end repeat
            if i ≥ 60 then return false
          end if
          exit repeat
        end if
      end repeat
    end tell
  end tell
end tell

ignoring application responses
  tell application "System Preferences" to quit
end ignoring

on wait4window(this_title)
  tell application "System Events"
    tell process "System Preferences"
      repeat with i from 1 to 60
        if exists (window 1) then
          if the name of window 1 is this_title then return true
        end if
        delay 1
      end repeat
    end tell
  end tell
  return false
end wait4window

on wait4disabled(this_object)
  tell application "System Events"
    tell process "System Preferences"
      repeat with i from 1 to 60
        if this_object is not enabled then return true
        delay 1
      end repeat
    end tell
  end tell
  return false
end wait4disabled
[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (9)  
  • Currently 1.57 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[8,088 views] Email Article To a Friend View Printable Version
Programatically enable/disable folder action scripts System
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.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (3)  
  • Currently 1.63 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[6,785 views] Email Article To a Friend View Printable Version
Convert text files to CSV format for analysis System
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:
  1. 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.)
  2. 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 (,).
  3. 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.
  4. 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.
  5. 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.]
  Post a comment  •  Comments (11)  
  • Currently 2.27 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (11 votes cast)
 
[26,510 views] Email Article To a Friend View Printable Version
A shortcut to see more info for Bluetooth devices System
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.]
  Post a comment  •  Comments (0)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[5,289 views] Email Article To a Friend View Printable Version
Switch between apps without seeing the app switcher System
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.]
  Post a comment  •  Comments (15)  
  • Currently 2.40 / 5
  You rated: 2 / 5 (10 votes cast)
 
[9,665 views] Email Article To a Friend View Printable Version
Delete some or all of text entered into Spotlight menu System
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).
  Post a comment  •  Comments (10)  
  • Currently 2.44 / 5
  You rated: 5 / 5 (9 votes cast)
 
[4,334 views] Email Article To a Friend View Printable Version
The hard way to find hidden Finder preferences System
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.
read more (335 words)   Post a comment  •  Comments (11)  
  • Currently 1.63 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[18,460 views] Email Article To a Friend View Printable Version
10.6: View full screen Quick Look via the keyboard System
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).]
  Post a comment  •  Comments (9)  
  • Currently 2.38 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[13,131 views] Email Article To a Friend View Printable Version