August 28, 2008
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)
BBEdit 9 is out. It doesn't suck.
One new cool feature is the Scratchpad, which is just a handy document that's always around and you don't have to worry about having to save and such.
Here's a quick python / applescript tool to pipe text from the shell to this window:
%-
#!/usr/bin/python import sys, os open('/tmp/scratchpad.bbedit', 'w').write(sys.stdin.read()) script = '''tell application "BBEdit" set the contents of the scratchpad window to read (POSIX file "/tmp/scratchpad.bbedit" as alias) open the scratchpad window tell scratchpad window to select insertion point before line 1 activate end tell'''-%this seems to be a little bit faster than using NSAppleScript
os.popen("/usr/bin/osascript -e '%s'" % (script))
Put that script in your path somewhere, make it executable (chmod 755 scratchpad.py), and use it like so: ls -al | scratchpad.py