Home
» Command Line Script to Pipe Text
Online Documentation
Command Line Script to Pipe Text.
This is a simple python script, that'll take text from stdin and pipe it to a page in VoodooPad:
#!/usr/bin/python import sys import os import getopt import string pageName = "piped text" if len(sys.argv) == 2: pageName = sys.argv[1] data = sys.stdin.read() data = data.replace('"', '\\"') script = '''tell application "VoodooPad" tell document 1 to create page with title "%s" with contents "" append text "%s" to page "%s" of document 1 activate end tell''' % (pageName, data, pageName) script = script.replace("'", "\\'") os.popen("/usr/bin/osascript -e '%s'" % (script))