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

10.6: Jump to path via global Service System 10.6
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.]
  • Currently 2.15 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (13 votes cast)

10.6: Jump to path via global Service | 7 comments | Create New Account
Click here to return to the '10.6: Jump to path via global Service' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Jump to path via global Service
Authored by: bhas on Nov 03, '09 10:12:46AM

It doesn't work well for me.
The dialog window doesn't always become the front most window.
And it doesn't get keyboard focus.
Or I get the error popup "The action “Run AppleScript” encountered an error."

[ Reply to This | # ]
10.6: Jump to path via global Service
Authored by: PCheese on Nov 03, '09 11:10:56AM

On a related note: if the path is displayed and selectable onscreen, you can just select it and use the built-in "Open" or "Reveal" services. For example, I selected the /Users/ text in your hint and right-clicked the selection, then chose "Open" from the "Services" submenu.

I generally make scripts that take "no input" into script menu scripts as opposed to services (since the whole point of services is that they're context-sensitive). However, you lose the ability to assign convenient keyboard shortcuts without third-party software like FastScripts.

[ Reply to This | # ]
Incorrect argument escaping
Authored by: PCheese on Nov 03, '09 11:22:31AM
By the way, the path escaping is incorrect. You should modify one line to be the following:
set myCommand to "open " & (quoted form of myPosix)

[ Reply to This | # ]
10.6: Jump to path via global Service
Authored by: krsmes on Nov 03, '09 02:54:38PM

The above script does not get focus when assigned a shortcut key.

Add the line “activate” after “on run {input, parameters}” fixes it.

on run {input, parameters}

[ Reply to This | # ]
10.6: Jump to path via global Service
Authored by: bobcole on Nov 04, '09 07:44:11PM
Put an AppleScript in the script menu of your menu bar. For example:
tell application "Finder"
  make new Finder window
  set target of Finder window 1 to folder "apache2" of folder "log" of folder "var" of item "private" of startup disk
  set current view of Finder window 1 to list view
end tell

[ Reply to This | # ]
10.6: Jump to path via global Service
Authored by: asmeurer on Nov 06, '09 05:51:08PM
I just use the open command with tab completion. It works very well, especially with tab completion set to be case insensitive and automatic using this hint.

[ Reply to This | # ]
10.6: Jump to path via global Service
Authored by: ehunt123 on Nov 08, '09 12:42:34PM

Open, while it has slowly evolved over the years, can be painful to work with, since Apple tends to have longer paths (~/Applications/, esoteric CFBundleIdentifiers, and I doubt it would be useful to write a sh* frontend to it that parses your Applications by path or MD (spotlight).

I stumbled onto this developer's project that still works great in 10.6, called launch.

It's open with many more features and lots of things Apple should have copied, er integrated into open.

Added bonus is it being opensource

[ Reply to This | # ]