Skip to content

Instantly share code, notes, and snippets.

@bomberstudios
Forked from dpk/gist:646570
Created October 26, 2010 16:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bomberstudios/647282 to your computer and use it in GitHub Desktop.
Save bomberstudios/647282 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>A9237092-D694-450A-8C8F-F9005D932664</string>
<key>command</key>
<string>osascript -e 'tell application "Safari" to set theSource to do JavaScript "window.document.documentElement.outerHTML" in document 1'</string>
<key>input</key>
<string>none</string>
<key>name</key>
<string>Get Generated Source from Safari</string>
<key>output</key>
<string>afterSelectedText</string>
<key>uuid</key>
<string>BCA87288-8CAB-4691-9A06-F8C38619FD1D</string>
</dict>
</plist>
-- based on John Gruber's original Safari Source in BBEdit script
-- http://daringfireball.net/2003/01/safari_source_in_bbedit
-- and duct tape, and modified to work with TextMate
tell application "Safari" to set theSource to do JavaScript "window.document.documentElement.outerHTML" in document 1
tell application "TextMate"
activate
set tmp to (do shell script "mktemp /tmp/textmate.XXXXXX")
open tmp
insert theSource
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment