Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gruber
Forked from dpk/gist:646570
Created October 26, 2010 16:26
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save gruber/647224 to your computer and use it in GitHub Desktop.
Save gruber/647224 to your computer and use it in GitHub Desktop.
Slight tweaks to dpkendal's script. Gives the BBEdit document a name (rather than "untitled <integer>", and skips the \n to \r stuff, which I don't think is necessary in recent versions of BBEdit.
tell application "Safari"
set _source to do JavaScript "window.document.documentElement.outerHTML" in document 1
set _name to name of document 1
end tell
tell application "BBEdit"
make new text window with properties ¬
{contents:_source, source language:"HTML", name:"Generated source: " & _name}
select insertion point before character 1 of text window 1
tell window 1
activate
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment