-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdf.scpt.txt
39 lines (34 loc) · 1 KB
/
cdf.scpt.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/oascript
try
tell application "Finder" to set the source_folder to (folder of the front window)
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
set source to source_folder as alias
end try
if kind of source_folder = "folder" then
set source to source_folder as alias
set thePath to (POSIX path of the source as string)
else
set the source_folder to the folder of source_folder
set source to source_folder as alias
set thePath to (POSIX path of source as string)
set the result to thePath
end if
set the clipboard to "cd " & quoted form of thePath
tell application "iTerm"
activate
tell the first «class Ptrm»
activate «class Cssn»
if ((count of «class Cssn») = 0) then
make new «class Ptrm»
«event ITRMLNCH» given «class Pssn»:"Default Session"
delay 1
end if
end tell
end tell
tell application "System Events"
tell process "iTerm"
click menu item "Paste" of menu "Edit" of menu bar 1
keystroke return
end tell
end tell