10.6: Jump to path via global Service

Nov 03, '09 07:30:59AM

Contributed by: Anonymous

Snow Leopard only hintWhen I'm working anywhere in 10.6 other than in the Finder, I might suddenly need to go to some path. It kind of bothers me that I have to Command-Tab to the Finder, and then do the Shift-Command-G keystroke. Also, I might want to open some Macintosh-style path (:) instead of POSIX-style (/) path.

Now, in 10.6, I can jump to a path using a Service. Here is a basic intro:

  1. Open Automator and choose Service from the Templates chooser.
  2. Make sure the Service receives "no input" in the pop-up menu at the top. Drag the Run AppleScript Action (in the Utilities Library), into the work area on the right, and enter this AppleScript in the Run AppleScript box:
    --Go to POSIX
    on run {input, parameters}
      tell application "Finder"
        set myName to (name of home) -- get your user name
      end tell
      set myPosix to (text returned of (display dialog "Enter a POSIX Path to jump to:" default answer "/Users/" & myName & "/Desktop/"))
      set myCommand to "open '" & myPosix & "'"
      do shell script myCommand
      end run
    If you prefer to user Macintosh-style paths, you can replace the set myCommand... and do shell script... lines above with just one line: set myCommand to (open alias myPosix)
  3. Save your Service with a relevant name (Go to Path or whatever), and quit Automator.
You can then assign your new Service a keyboard shortcut on the Keyboard Shortcuts tab of the Keyboard System Preferences panel.

[robg adds: I tested the POSIX path version of the script, and it worked as described.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20091019131259921