About

Gets the Unix path for the front-most Finder window, using the Desktop if there is none.

Usage

Save the script using Script Editor and open select it in Quicksilver. Choose the Run action. The Unix path will be copied to the clipboard, selected in Quicksilver, or typed into the frontmost application.

Known Issues

None

Requirements

  • Quicksilver

Source Code

on get_unix_path()
  tell application "Finder"
    set theText to POSIX path of ((path to desktop folder) as alias)
    if exists front window then
      set theText to POSIX path of (target of front window as alias)
    end if
  end tell
  return theText
end get_unix_path


(*Choose what you want it to do:*)
(*uncomment the next line to have the path selected in QS*)
--tell application "Quicksilver" to open location my get_unix_path()
(*uncomment the next line to have Quicksilver open the path as a string*)
--tell application "Quicksilver" to open my get_unix_path()
(*uncomment the next line to have the path copied to the clipboard*)
--set the clipboard to get_unix_path()
(*or, insert the path directly into the front application*)
--set t to get_unix_path()
--tell application "System Events"
  --tell front window
    --keystroke t
  --end tell
--end tell

Credits

Written by cormullion & leifbrown.

Version History

27.11.2004 shorter Applescript by cormullion
27.11.2004 cormullion's original script modified slightly by leifbrown
28.11.2004 a few final corrections by cormullion

Disclaimer

This add-on may be freely distributed. It is not guaranteed to work (though it has been extensively tested), and you use it at your own risk. Post suggestions in the forums.