Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set targetFolder to path to home folder
- -- See if active window is a Terminal window
- tell application "System Events"
- set frontApp to name of (first application process whose frontmost is true)
- if frontApp is "iTerm2" then
- -- If so, set target folder to the current terminal's `pwd`
- tell application "iTerm"
- tell current session of current window
- set targetFolder to ((variable named "session.path") as POSIX file)
- end tell
- end tell
- end if
- end tell
- -- Open the new Finder window
- tell application "Finder"
- set target of (make new Finder window) to targetFolder
- end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement