Last active
August 29, 2015 14:22
-
-
Save cmittendorf/d23cce628da08c0c492f to your computer and use it in GitHub Desktop.
This script creates a new document in BBEdit from the the content of your current Terminal window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set content to missing value | |
display dialog ¬ | |
"Which contents do you want to insert?" buttons {"Cancel", "Complete Buffer", "Currently visible content"} ¬ | |
default button ¬ | |
"Currently visible content" cancel button ¬ | |
"Cancel" with title ¬ | |
"Copy contents from Terminal.app" giving up after 10 | |
if button returned of result is "Complete Buffer" then | |
tell application "Terminal" | |
tell its first window | |
tell selected tab | |
set content to get history | |
end tell | |
end tell | |
end tell | |
else if button returned of result is "Currently visible content" then | |
tell application "Terminal" | |
tell its first window | |
tell selected tab | |
set content to get contents | |
end tell | |
end tell | |
end tell | |
end if | |
if content is not missing value then | |
tell application "BBEdit" | |
make new document with properties {contents:content} | |
activate | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment