| ... | ... |
@@ -1,11 +1,32 @@ |
| 1 |
+function savepath() {
|
|
| 2 |
+ pwd > ~/.current_path~ |
|
| 3 |
+} |
|
| 4 |
+ |
|
| 1 | 5 |
function tab() {
|
| 2 |
- osascript 2>/dev/null <<EOF |
|
| 3 |
- tell application "System Events" |
|
| 4 |
- tell process "Terminal" to keystroke "t" using command down |
|
| 5 |
- end |
|
| 6 |
- tell application "Terminal" |
|
| 6 |
+savepath |
|
| 7 |
+osascript >/dev/null <<EOF |
|
| 8 |
+on do_submenu(app_name, menu_name, menu_item, submenu_item) |
|
| 9 |
+ -- bring the target application to the front |
|
| 10 |
+ tell application app_name |
|
| 7 | 11 |
activate |
| 8 |
- do script with command "cd \"$PWD\"; $*" in window 1 |
|
| 9 | 12 |
end tell |
| 13 |
+ tell application "System Events" |
|
| 14 |
+ tell process app_name |
|
| 15 |
+ tell menu bar 1 |
|
| 16 |
+ tell menu bar item menu_name |
|
| 17 |
+ tell menu menu_name |
|
| 18 |
+ tell menu item menu_item |
|
| 19 |
+ tell menu menu_item |
|
| 20 |
+ click menu item submenu_item |
|
| 21 |
+ end tell |
|
| 22 |
+ end tell |
|
| 23 |
+ end tell |
|
| 24 |
+ end tell |
|
| 25 |
+ end tell |
|
| 26 |
+ end tell |
|
| 27 |
+ end tell |
|
| 28 |
+end do_submenu |
|
| 29 |
+ |
|
| 30 |
+do_submenu("Terminal", "Shell", "New Tab", 1)
|
|
| 10 | 31 |
EOF |
| 11 |
-} |
|
| 12 | 32 |
\ No newline at end of file |
| 33 |
+} |