forklift.plugin.zsh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Open folder in ForkLift.app from console
  2. # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
  3. #
  4. # Usage:
  5. # fl [<folder>]
  6. #
  7. # Opens specified directory or current working directory in ForkLift.app
  8. #
  9. # Notes:
  10. # It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
  11. # app window.
  12. #
  13. # https://gist.github.com/3313481
  14. function fl {
  15. if [ ! -z "$1" ]; then
  16. DIR=$1
  17. if [ ! -d "$DIR" ]; then
  18. DIR=$(dirname $DIR)
  19. fi
  20. if [ "$DIR" != "." ]; then
  21. PWD=`cd "$DIR";pwd`
  22. fi
  23. fi
  24. osascript 2>&1 1>/dev/null <<END
  25. tell application "ForkLift"
  26. activate
  27. end tell
  28. tell application "System Events"
  29. tell application process "ForkLift"
  30. try
  31. set topWindow to window 1
  32. on error
  33. keystroke "n" using command down
  34. set topWindow to window 1
  35. end try
  36. keystroke "g" using {command down, shift down}
  37. tell sheet 1 of topWindow
  38. set value of text field 1 to "$PWD"
  39. keystroke return
  40. end tell
  41. end tell
  42. end tell
  43. END
  44. }