Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cmittendorf/d23cce628da08c0c492f to your computer and use it in GitHub Desktop.
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.
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