Print on Nyquist Easily from CEB 531

by Ryan Northcott
of the Spinning LED Clock Group
Posted 26 Mar 2001

To start off, I would like to appologize to everyone who would have found this script useful several reports ago! It has been quite a technical challenge for me to write this script. I hope that it is useful to many people not only in EE 552, but in all courses that use the CEB 531 lab. Perhaps it will also serve as a bit of a tutorial for PERL script as well! I tried to put some comments into the code to make it understandable. Please take a look! And now for an explanation of what this script does...

If your university experience has been anything like mine, you have learned to despise, with great feeling, the printer in CEB 531. In my humble opinion, this printer is possessed by THE DEVIL!!! Not only does it not function properly the majority of the time, but it also charges you 10 cents per page. What a rip off! Many of us are required to use software in the 531 lab but printing is always a hassel. When the 531 printer starts charging you to spit out blank pages instead of the files that you requested, most people try to print elsewhere. However, this involves the often tedious process of copying the files over to your Nyquist account using FTP or some other program. Then you must Telnet into nyquist and spool the files to the printer using the lpr command. This can be quite a pain.

How would you like it if you could do all of this by typing one command from the terminal window? Wouldn't that be fantastic! I've dreamed about this myself for months! Finally, I have found a solution. I have spent upwards of 24 hours researching information on PERL script and writing a simple program that would do just this very thing. Now, I offer it to you so that all may reap the benefits of 5 cent printing on printers that actually work properly!

Here's what you must do to install it:

  1. Copy the file pon.pl to your root directory in the 531 lab.
  2. Make the file pon.pl executable by typing the command:
    chmod 700 pon.pl
  3. Create a subdirectory in your root directory called 'PrintFiles' by typing the command:
    mkdir PrintFiles
    Make sure to get the capitalization correct!
  4. Telnet over to your Nyquist account and create a subdirectory by the same name in your root directory by typing:
    mkdir PrintFiles
    Once again, mind the capitalization.
  5. Log out of your Nyquist account.

Here's how to use the script:

  1. When printing from any program in the 531 lab, make sure that the "Print To File" option is selected in either the "Print" or "Print Setup" dialog box. Type in the path to the 'PrintFiles' directory in the filename box as: ~/PrintFiles/
  2. From your root directory in the 531 lab, type:
    pon.pl
    That is short for "Print on Nyquist".
  3. The script will ask you to select a Nyquist printer to print to from a list of available printers. Type the number of the printer that you wich to print on and press return.
  4. The script will then ask you to enter you login name and password for your nyquist account. Type these in. Your password will not be echoed to the screen to protect your privacy.
  5. The script will then ask you for your password again. I wanted to avoid this problem but I have not been able to find a way around it. This is due to the fact that the FTP program does not read the password from standard input but uses some kind of terminal emulation technique to get your password from you. If anyone knows how to get around this, please let me know. But for the mean time, we'll just have to deal with typing the password twice.
  6. The script will then log into your nyquist account using FTP and copy all of the .ps files in your local 'PrintFiles' directory to your nyquist 'PrintFiles' directory.
  7. After ending the FTP session, the script will then log into you nyquist account using Telnet. Once the connection is established, it will spool all of the .ps files to the printer that you selected, and then delete them.
  8. After ending the Telnet session, the script will ask you if you would like to delete the postscript files from your local directory. Type "y" to delete them all or "n" to save them for later. If you do not delete them, they will be printed again the next time you run the script.

Notes for the technically astute:


For more info on writing PERL scripts, visit, www.perl.com.

by Ryan Northcott
of the Spinning LED Clock Group
Posted 26 Mar 2001