on run {input, parameters}
tell application "Finder"
set dir_path to "\"" & (POSIX path of (input as string)) & "\""
-- display dialog dir_path
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
try
set t to the last terminal
on error
set t to (make new terminal)
end try
tell t
launch session "Default Session"
tell the last session
write text "cd " & theDir & ";clear;"
end tell
end tell
end tell
end CD_to
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
12