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

Set up Windows 7 'Aero Snap' workalikes in OS X System
You may know about the Aero Snap feature of Windows 7 which allows a user to "resize to half" a window by dragging it to the left or right side of the screen, or to maximize it by dragging it to the top edge of the screen (or by using shortcuts).

With a few AppleScripts and the shortcut manager Spark, you can get this feature in Mac OS X -- at least via shortcuts, though not by dragging to a screen edge.
read more (565 words)   Post a comment  •  Comments (8)  
  • Currently 2.90 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (20 votes cast)
 
[21,345 views] Email Article To a Friend View Printable Version
Set files' modification time from Finder System
This hint is about touching files from the Finder to update their mod time, much as you can do in Terminal with the touch command. Here's how:
  1. Select files to be 'touched' in the Finder.
  2. Press Command-Option-I to open the multiple item info inspector window (File » Show Inspector).
  3. Toggle/activate the Open With pop-up menu. You needn't select anything, just click to activate the menu.
The file's modified timestamp will be updated to now time; tested in 10.6.2.

[robg adds: In my testing, I didn't have any luck with the time changing just by merely activating the menu; I had to select the currently-active option for the chosen files. If I selected files with different Open With settings (such that the pop-up menu reads Not Applicable), I couldn't change the modification timestamp at all via this method.]
  Post a comment  •  Comments (14)  
  • Currently 1.76 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (25 votes cast)
 
[7,004 views] Email Article To a Friend View Printable Version
Add Quick Look Support for MKV Files System
First download and install the Perian QuickTime codec package, if you haven't done so already. Then download NicePlayer, and drag it to your Applications folder. Once that's done, launch NicePlayer and then quit it. Now open a new Terminal window and type the following to reload the Quick Look server:
qlmanage -r
Once you've done that, you should be able to open any MKV file in Quick Look. At this point, you can delete NicePlayer if you want, as it's already served its purpose. I've only tested this in Snow Leopard, but I assume it would work for Leopard as well, as NicePlayer only requires 10.4 or higher. On the off chance it doesn't work, though, you can try this QuickTime hack.
  Post a comment  •  Comments (15)  
  • Currently 3.27 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (26 votes cast)
 
[20,096 views] Email Article To a Friend View Printable Version
Change the user on networked Time Machine backups System
When I first set up Time Machine over the network, I realized that I didn't want the backup to happen using my regular user account, so that I could change my personal password at will. This hint quickly lists the steps you need to go through in order to make the change to an existing sparsebundle, so that you can keep doing incremental backups. It avoids the pain of a full backup after changing the user.

This setup assumes the following: Mac Pro with connected FW800 external drive and MacBook Pro laptop. Mac Pro backs up locally along with the MBP storing a sparsebundle over the network onto the same disk.

First, turn off Time Machine for the device associated with the sparsebundle you are changing. At a high level, the steps are:
  1. Create a new user on the Mac Pro called backup.
  2. Recursively change the permissions on the sparsebundle to include backup.
  3. Check whether the mount works correctly from the MBP.
  4. Turn Time Machine back on.
Read on for the detailed walkthrough...
read more (302 words)   Post a comment  •  Comments (4)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (14 votes cast)
 
[7,076 views] Email Article To a Friend View Printable Version
Uninstall an AppleScript application from within Itself System
If you make tiny apps that you distribute to friends and family who aren't particularly Mac-literate, you might find this snippet of code helpful:
set theUNIXPath to path to me as alias
set thePosixPath to (POSIX path of theUNIXPath) as string
set thePosixPath to (items 1 thru ((length of thePosixPath) - 1) of thePosixPath)
		
do shell script "sleep 1 &> /dev/null &
mv " & thePosixPath & " ~/.trash/YOURAPPNAMEGOESHERE.app"
return
Basically, any app with that code inserted (and properly activated based on response to a user's action) moves itself to the trash.

How it works: it calls sleep 1 with a bash redirection command &> /dev/null &, which initiates the script, but returns to the app immediately. The effect is that your AppleScript app will exit before the second command moves the app to the trash.
  Post a comment  •  Comments (16)  
  • Currently 1.77 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (13 votes cast)
 
[6,226 views] Email Article To a Friend View Printable Version
Move the cursor during Page Up, Page Down scrolling System
When you hit Page Up or Page Down in certain OS X programs (TextEdit for one), the cursor position normally doesn't move; only your scroll position does. As a result, typing or using an arrow key will zoom you back to the cursor position. If you prefer to move the cursor position too, hold Option along with Page Up or Page Down. You can add in Shift to select the text, too.

[robg adds: This won't work in every app; I couldn't make it work in Mail in 10.5, for instance. It worked in TextEdit in both 10.5 and 10.6, though.]
  Post a comment  •  Comments (6)  
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (18 votes cast)
 
[10,999 views] Email Article To a Friend View Printable Version
Transfer a Time Machine disk to a disk image file System
What if you have a local hard disk being used as a Time Machine backup, and you want to move it to a server, to encrypt it, or otherwise make it more easily moveable? However, you'd like to continue to use it as a Time Machine backup store without losing your history.

One way to achieve this seems to be to copy the Time Machine hard disk to a disk image (optionally encrypted), which can then be copied, moved around, and used for continuing Time Machine backups.

It is done in three steps in the terminal:
  1. Create an image (optionally encrypted) of the same size as the Time Machine hard disk. You can use the script from this hint, or simply copy and execute the relevant parts of it. With the script, the command would look something like this:
    mkBackupImage.sh -p /path/to/disk/image -s nnn
    Replace the nnn with the size of the original Time Machine disk (and replace the path bit, too).
  2. Mount the new image:
    open /path/to/disk/image
  3. Use asr to make a block copy of the hard disk to the image:

    sudo asr --source /Volumes/TM_backup --target /Volumes/mounted_image_name --erase
Read on for a quick example, and a cautionary note on restoring from the new disk image backup.
read more (163 words)   Post a comment  •  Comments (0)  
  • Currently 1.90 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (20 votes cast)
 
[8,706 views] Email Article To a Friend View Printable Version
Completely disable quarantine of downloaded files System
Starting in Leopard (I believe) when you open a file downloaded from the web, OS X asks if you really mean it. While it is intended to stop maliciousness, it is only a source of aggravation for me. While there are some hints here on working around it, it turns out that you can disable it completely using a Terminal command:
defaults write com.apple.LaunchServices LSQuarantine -bool NO
After that, reboot, and you should be set. (If you want to disable quarantine for files already downloaded, you can run this in 10.6 : xattr -d -r com.apple.quarantine ~/Downloads. In 10.5, you need to use this instead: find ~/Downloads -type df -exec xattr -d com.apple.quarantine {}.)

The credit for this tip should really go to Jonathan 'Wolf' Rentzsch, who published it on his Tumblr. He, in turn, credits Ken Aspeslagh with telling him about the defaults write via Twitter.

[robg adds: This should work in 10.5 and 10.6, though I haven't tested it myself.]
  Post a comment  •  Comments (25)  
  • Currently 3.87 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (55 votes cast)
 
[41,149 views] Email Article To a Friend View Printable Version
Minimize/unminize all windows in the active application System
Now that it seems increasingly unlikely that Unsanity will update WindowShade X for Snow Leopard, I wanted some kind of substitute. In Snow Leopard, you can minimize (actually "miniaturize") windows to the program's Dock icon (enable this in the Dock System Preferences panel), and you can double-click on a window title bar to do this. Nice and out of the way.

But getting such windows back requires excessive mouse movements. (Either activate Exposé and click on the window, or right-click on the application's Dock icon and select the window by name from a menu. Then you must mouse back up to the window. If you do this constantly, it gets very frustrating and prone to strain.

This AppleScript will either miniaturize all windows in the active (frontmost) application, or un-miniaturize them all. The difference between the two behaviors is controlled by one script property (theval). So create two versions of the script, one with theval set to true (to miniaturize), and one with theval set to false (to un-miniaturize). Here's the "miniaturize" version:
(*
Frontmost miniaturize / unminiaturize
by Wooden Brain Concepts
11-18-2009

miniaturize (to dock) or unminiaturize all windows in the frontmost app.
This works in many but not all applications.
Suggest using it with a keyboard macro program and/or a mapped mouse button, etc.

*)

-- theval = true : miniaturize ; theval = false : unminiaturize 
property theval : true
-- require windows to be resizable?  (default: false)
property requireresizable : false
-- must all windows have a title to unminiaturize only? (default: true)
property windows_must_have_titles : true
--window names to exclude when unminiaturizing only (default: {"Downloads", "Invite"})
property exclusions : {"Downloads", "Invite"}
-- gui scripting main window for these apps (by bundle id) (default: {"com.microsoft.entourage", "ws.agile.1Password"})
property guiscripting : {"com.microsoft.entourage", "ws.agile.1Password"}

tell application "System Events"
  set bi to bundle identifier of (some process whose frontmost is true)
end tell

(*
-- testing only
--set bi to "com.apple.finder"
set bi to "com.apple.itunes"
set bi to "com.apple.systempreferences"
*)

if not theval and (bi is in guiscripting) then
  (*
  this is special handling for some unscriptable apps.  this whole conditional can be eliminated if you don't use it. it requires "Enable access for assistive devices" in Universal Access Preference Pane to be on to enable GUI access scripting. have not yet figured out how to miniaturize to dock.
  *)
  set thisapp to ""
  set theindex to 1
  if bi is "com.microsoft.entourage" then
    set thisapp to "Microsoft Entourage"
  else if bi is "ws.agile.1Password" then
    set thisapp to "1Password"
  end if
  if not theval and thisapp is not "" then
    tell application thisapp to activate
    try
      tell application "System Events"
        tell process thisapp
          tell menu bar 1
            tell menu bar item "Window"
              tell menu "Window"
                if bi is "com.microsoft.entourage" then
                  set winmenuitems to name of every menu item
                  set theindex to 11
                  -- get best guess at main window
                  repeat with i from 11 to (count winmenuitems)
                    if (item i of winmenuitems contains "—") or (item i of winmenuitems begins with "Folders") then
                      set theindex to i
                      exit repeat
                    end if
                  end repeat
                  click menu item theindex
                else if bi is "ws.agile.1Password" then
                  click menu item "Main Window"
                end if
              end tell
            end tell
          end tell
        end tell
      end tell
    on error myerr
      -- log myerr
    end try
  end if
else if bi is "com.apple.itunes" then
  -- special case for itunes :  minimize (mini-player) rather than miniaturize (to dock) the main iTunes window
  tell application "iTunes"
    set minimized of browser window 1 to theval
    activate
  end tell
else
  tell application id bi
    try
      set wins to every window whose closeable is true
      repeat with awin in wins
        try
          if bi is "com.apple.finder" then
            using terms from application "Finder"
              -- finder windows use the property "collapsed" rather than "miniaturized" -- annoying
              if closeable of awin and ((resizable of awin is true) or not requireresizable) and ((theval and visible of awin) or (not theval and (get collapsed of awin) and name of awin is not in exclusions)) and (not windows_must_have_titles or (windows_must_have_titles and name of awin is not "")) then
                try
                  set collapsed of awin to theval
                end try
              end if
            end using terms from
          else
            if closeable of awin and ((resizable of awin is true) or not requireresizable) and ((theval and visible of awin) or (not theval and miniaturized of awin and name of awin is not in exclusions)) and (not windows_must_have_titles or (windows_must_have_titles and name of awin is not "")) then
              try
                set miniaturized of awin to theval
              end try
            end if
          end if
        on error myerr
          -- log if desired
          --log myerr
        end try
      end repeat
    on error myerr
      -- log if desired
      -- log myerr
    end try
    activate
  end tell
end if
Each script can then be attached to a keyboard combo (with a keyboard macro program such as QuicKeys). I have also triggered the scripts with a programmable trackball (using Kensington MouseWorks), so I can perform both actions with the trackball without moving the mouse pointer. (Similar results could be achieved with other mouse drivers, I believe.)

Certain options are definable in the script properties. This script works in many but not all applications, and some workarounds using GUI access scripting were included for MS Entourage and 1Password.

[robg adds: I tested this script in both 10.5 and 10.6, and it works as described in both versions of the OS. As noted, it will not work in all applications.]
  Post a comment  •  Comments (19)  
  • Currently 2.53 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[8,224 views] Email Article To a Friend View Printable Version
Preserve app preferences and settings when using FileVault System
I use FileVault to encrypt the contents of my home folder. In the case of my laptop being stolen or lost, the new user should therefore be unable (or find it extremely hard at least) to access my work and personal confidential data.

FileVault is very powerful, but it has a downside: FileVault loses some of my file associations and related preferences each time I log out, restart, or shutdown. For example, my preferred browser is Firefox, not Safari. Therefore, every time I log in, I have to reset the Firefox to be my 'Default web browser' in the Safari settings dialog.

Since OS X v10.4, this behaviour has been driving me to distraction. This is a known problem, and has been widely reported by FileVault users (see this hint, for instance). I was hoping that this would have been fixed with 10.6.2, but alas, the problem continues. So I set out to solve it.
read more (223 words)   Post a comment  •  Comments (8)  
  • Currently 2.06 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (16 votes cast)
 
[6,062 views] Email Article To a Friend View Printable Version