Skip to content

Instantly share code, notes, and snippets.

@davidfmiller
Last active July 5, 2017 18:06
Show Gist options
  • Save davidfmiller/7af260ea308f9bcd53a66102d5c3f7c8 to your computer and use it in GitHub Desktop.
Save davidfmiller/7af260ea308f9bcd53a66102d5c3f7c8 to your computer and use it in GitHub Desktop.
Open source of current Safari document in BBEdit
(*
Open source of current Safari document in BBEdit
David Miller
https://readmeansrun.com
*)
set mycontents to ""
set myname to ""
try
tell application "Safari"
set mytab to current tab of window 1
set mycontents to source of mytab
set myname to URL of mytab
end tell
tell application "BBEdit"
set doc to make new document
set contents of doc to mycontents
set name of doc to myname
activate
end tell
on error
beep
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment