Add support for ForkLift 2 to the ForkLift plugin
The ForkLift plugin now supports ForkLift 2 as well as ForkLift 1.
If ForkLift is not running it also waits for it to be running before
trying to switch to the specified directory
Diff
1diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
2index 056069d36211daa345cf245105fbfe1ee104c993..b0e60a43440f45a3369732818c6ad3dd2bee719e 100644
3--- a/plugins/forklift/forklift.plugin.zsh
4+++ b/plugins/forklift/forklift.plugin.zsh
5@@ -1,5 +1,6 @@
6-# Open folder in ForkLift.app from console
7+# Open folder in ForkLift.app of ForkLift2.app from console
8 # Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
9+# Updated to support ForkLift2 by Johan Kaving
10 #
11 # Usage:
12 # fl [<folder>]
13@@ -22,9 +23,33 @@ function fl {
14 fi
15 fi
16 osascript 2>&1 1>/dev/null <<END
17- tell application "ForkLift"
18- activate
19- end tell
20+
21+ try
22+ tell application "Finder"
23+ set appName to name of application file id "com.binarynights.ForkLift2"
24+ end tell
25+ on error err_msg number err_num
26+ tell application "Finder"
27+ set appName to name of application file id "com.binarynights.ForkLift"
28+ end tell
29+ end try
30+
31+ if application appName is running
32+ tell application appName
33+ activate
34+ end tell
35+ else
36+ tell application appName
37+ activate
38+ end tell
39+ repeat until application appName is running
40+ delay 1
41+ end repeat
42+ tell application appName
43+ activate
44+ end tell
45+ end if
46+
47 tell application "System Events"
48 tell application process "ForkLift"
49 try
50@@ -36,7 +61,7 @@ function fl {
51 keystroke "g" using {command down, shift down}
52 tell sheet 1 of topWindow
53 set value of text field 1 to "$PWD"
54- keystroke return
55+ keystroke return
56 end tell
57 end tell
58 end tell