#!/usr/bin/expect # # (c) Sean Parkin 2013/09/22: plt2ps # # An 'expect' script to automate creation of PostScript files from binary format # '.plt' files written by George Sheldrick's XP molecule editing program. Spawns # XP and anticipates/controls input using the unix/linux utility 'expect'. This # 'expect' script is meant to be invoked from another script (e.g. xpdraw), with # a call for each of the '.plt' file that is present in the directory from which # it is run. It can also be used as a standalone by typing plt2ps filename from # a shell prompt. # # 'Expect' is an extension of Tcl, and is the work of Don Libes at the NIST. # # Note: If you want to see the bypassed XP interactive blurbage scrolling up the # screen, just comment out the next line. log_user 0 set filename [lindex $argv 0] spawn xpx expect "XP>> " { send "draw $filename\r" } expect "Draw: " { send "a\r" } expect "ated: " { send "$filename.ps\r" } expect "CR>): " { send "c\r" } expect "XP>> " { send "exit\r" } expect " " { send "\r" }