1 # Open folder in ForkLift.app or ForkLift2.app from console
2 # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
3 # Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
4 # Updated to support ForkLift from Setapp by Paul Rudkin
9 # Opens specified directory or current working directory in ForkLift.app
12 # It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
15 # https://gist.github.com/3313481
17 if [ ! -z "$1" ]; then
19 if [ ! -d "$DIR" ]; then
22 if [ "$DIR" != "." ]; then
26 osascript 2>&1 1>/dev/null <<END
29 tell application "Finder"
30 set forkLiftSetapp to name of application file id "com.binarynights.forklift-setapp"
32 on error err_msg number err_num
33 set forkLiftSetapp to null
36 tell application "Finder"
37 set forkLift3 to name of application file id "com.binarynights.ForkLift-3"
39 on error err_msg number err_num
43 tell application "Finder"
44 set forkLift2 to name of application file id "com.binarynights.ForkLift2"
46 on error err_msg number err_num
50 tell application "Finder"
51 set forkLift to name of application file id "com.binarynights.ForkLift"
53 on error err_msg number err_num
57 if forkLiftSetapp is not null and application forkLiftSetapp is running then
58 tell application forkLiftSetapp
60 set forkLiftVersion to version
62 else if forkLift3 is not null and application forkLift3 is running then
63 tell application forkLift3
65 set forkLiftVersion to version
67 else if forkLift2 is not null and application forkLift2 is running then
68 tell application forkLift2
70 set forkLiftVersion to version
72 else if forkLift is not null and application forkLift is running then
73 tell application forkLift
75 set forkLiftVersion to version
78 if forkLiftSetapp is not null then
79 set appName to forkLiftSetapp
80 else if forkLift3 is not null then
81 set appName to forkLift3
82 else if forkLift2 is not null then
83 set appName to forkLift2
84 else if forkLift is not null then
85 set appName to forkLift
88 tell application appName
90 set forkLiftVersion to version
92 repeat until application appName is running
95 tell application appName
100 tell application "System Events"
101 tell application process "ForkLift"
103 set topWindow to window 1
105 keystroke "n" using command down
106 set topWindow to window 1
108 keystroke "g" using {command down, shift down}
109 if forkLiftVersion starts with "3" then
110 tell pop over of list of group of splitter group of splitter group of topWindow
111 set value of text field 1 to "$PWD"
114 tell sheet 1 of topWindow
115 set value of text field 1 to "$PWD"