Home Products Support About SD Contact SD

dot

JAGUAR FAQs

Customizing print operations with Print Scripts


When you press the 'Print' button on any grid, the grid appears as a printed page on your printer. This scheme is useful for most situations. However, since the 255x VCS system was flexibly designed, many variations of the path that the plot can take are now possible.

This document describes some of the ways that you can customize your printing procedure.


  • <B>Script Files. A UNIX script is a file that contains keyboard commands as you would enter them at the '%' prompt. Scripts are helpful in automating repetitive operations. A simple script follows:

      #!/bin/csh -f
      #
      # The pound signs (#) are comments
      # and the text is ignored.
      # EXCEPT FOR THE FIRST LINE THAT INVOKES THE SHELL TO EXECUTE IT!
      #
      echo "This file is a script"
      #

    Open the Text Editor (to access, select Workspace | Programs | Text Editor), enter the above text, save the text as a file called 'print-script' and then exit the Text editor. Now, you must make this new file executable with the command:

      % chmod +x print_script
      %
    To execute and test this script file, enter the filename at the % prompt.

      % print_script
      This file is a script
      %

    In addition, the script file can compare internal values and then branch to other commands that are out of sequence. This decision making ability causes scripts to be very helpful during intelligent repetitive operations.


  • Print Operations - Inside the 'Print Command' window (to access, press the right mouse button on the 'Print' button and then press the left mouse button on the 'Print Command' selection), there are three command lines. They are labeled "Text", "B/W Graphics" and "Color Graphics". The command line contains either a valid UNIX command or a script file name. For example, the "Text" command is "lp -o nobanner". The VCS application appends the name of the PostScript file to the end of the command. Thus, the complete UNIX command that you could enter at the % prompt would be:
      % lp -o nobanner /tmp/pfileAAAa000Nj.ps
    For another example, the "B/W Graphics" command is the script file "default_printer". When the VCS application appends the PostScript file name, the complete command becomes:
      % default_printer /tmp/pfileBAA000Nj.ps
    This script, located in your home directory (/usr/home/vcs), uses the appended PostScript filename as an argument.

    NOTE: If the UNIX command includes the variable '$FILE', the '$FILE' variable will be replaced by the actual filename of the PostScript file and the filename will not be appended to the command. The variable '$FILE' may be used more than once.



  • Print Command Files - Any command that appears on the above command lines can be collected into a file for selection at a later time. The "Text" commands are located in the file '.text_print_commands' that is located in the user's home directory. The "B/W Graphics" commands are located in the file '.mono_print_commands' which is also located in the user's home directory. The "Color Graphics" commands are in the file '.color_print_commands'.

    These files are containers for the many different scripts or UNIX commands that you may need to completely customize your system.

    Select the "[v]" object on each command line to access the contents of each file.

    NOTE: after selecting a command, be sure to press the 'Return' key before pressing the 'Apply' or 'Save' button.

    NOTE: after adding or deleting entries to these files, be sure to logout and login to cause the change to take effect.



  • Sample Print Scripts - The following script files show typical uses. Please enter the text into a file (for example, use "print_script" as a filename) with the Text Editor and make the file executable as shown above. The script file name should be entered on the appropriate command line in the 'Print Commands' window or stored in the appropriate print command file.

      B/W Graphics [v] print_script


    1. A script to print the PostScript file name generated by the application and then remove it. Be sure to open the 'xconsole' window to see the name appear.

      #!/bin/csh-f
      #
      # Print the filename on the console. . .
      echo "The filename is: $1" > /dev/console
      #
      # . . .and remove the file so they won't accumulate
      rm $1
      #

    2. A script file to move the PostScript file into a directory (psfiles) within the user's home directory. Be sure to create this directory with the command "% mkdir psfile". Use the command "% ls psfiles" to show the contents of this directory.

      #!/bin/csh -f
      #
      # Rename the file into another directory
      mv $1 $HOME/psfiles
      #

    3. A script file to move the PostScript file to a unique filename based on the current date and time.

      #!/bin/csh -f
      #
      # Rename the file to a unique filename
      set day=`date +%h_%d_%y_%T`
        (Remember to use the back apostrophe character)
      mv $1 $HOME/psfiles/$day.ps
      #

    4. A script file to move the PostScript file to a directory specified in the "B/W Graphics" command line. In this example, the directory is 'psfiles', but another directory can be entered onto the command line before the 'Print' button is pressed. [MANY THANKS TO DAVE PARKER]

      B/W Graphics: [v] print_script psfiles

      #!/bin/csh -f
      #
      # If the directory does not exist, create it
      if (! -e $HOME/$1) mkdir -p $HOME/$1
      #
      # Move the PostScript file to the new directory
      mv $2 $HOME/$1
      #

    5. Two script files to prompt the operator for a filename and directory in which to store the PostScript file. In this case a second script file is needed to ask the question of the user. It is called 'ask_filename' and must be made executable.

    Here is the file 'print_script'.

      #!/bin/csh
      #
      # run the second script in a pop-up window
      # (. . . and pass the PostScript filename in the argument list)
      /usr/openwin/bin/xterm -e $HOME/ask_filename $1
      #

    Here is the file 'ask_filename'.

      #!/bin/csh
      #
      # Ask for the file
      echo "Enter the filename of the new file:"
      #
      # Get the answer
      set file=$<
      #
      # Ask for the directory path
      echo "Enter the FULL path to this file:"
      set path=$<
      #
      # If the directory does not exist, create it
      if (! -e $path) mkdir $path
      #
      # Move the PostScript file to the new location
      mv $1 $path/$file
      #
      # Leave the window on screen until killed
      echo "Press the 'Return' key to quit"
      set ans=$<
      #


    6. A script file to use the pop up message window 'xmes'.

      #!/bin/csh -f
      #
      # Show the message window
      xmes -bg lightblue 1 "Which file should be used?" 2 "1234.ps" "abcd.ps"
      #
      # Use the proper button
      if ($status == 1) then
        mv $1 $HOME/1234.ps
      else
        mv $1 $HOME/abcd.ps
      endif
      #

    7. The Sun utility 'Imagetool' can be used to save the PostScript format file into another graphic format. The available new formats are 'EPSF', 'GIF' 'JFIF (JPEG)', 'Sun Raster' and 'TIFF'. Imagetool is able to rotate, scale, mirror and other graphical operations before the file is saved. Use the command '% man imagetool' to learn more about this utility. The 'print_script' file is shown below.

      #!/bin/csh -f
      #
      # Call the Sun Image Tool utility
      imagetool $1
      #

    8. An unsupported utility called 'print-xfig' can be used to add clarifying text and to draw lines and arrows onto the PostScript plot file before it is printed. You must contact Technical Support to receive the two diskettes to be installed prior to using 'print_xfig'. The 'print_script' file is shown below.

      #!/bin/csh -f
      #
      # Call the print_xfig utility
      /usr/local/bin/print_xfig $1
      #

    9. If your printer does not support formatted ASCII text files then you must convert these files to PostScript format prior to activating the printer. Call the following script file with the 'a2pd_script' command at the 'Text' command line. Enter the folowing lines into a file called 'a2ps_script'

      #!/bin/csh -f
      #
      # a2ps is the 'ASCII to PostScript' conversion utility.
      # -nP -> print to standard out
      # -nu -> don't print filename footer
      # -nH -> don't print header (filename and date, filename is wrong)
      #
      # For more information on changing the printed format, please
      # enter the following command into an Xterm window:
      # % a2ps -h
      #
      a2ps -nP -nu -nH $1 | lp

  • Logo Support - You can customize your plots with your own company's logo, your customer's logo or Spectral Dynamic's logo.

    Prepared script files already exist in your home directory (/usr/home/vcs) to facilitate logo usage. The Spectral Dynamics logos are carefully positioned on the plot depending on whether a plot is single or multiple grids and the orientation is landscape (wider horizontally) or portrait (wider vertically).

    A script called 'default_printer' merges a generic PostScript file called 'logo.ps' with the PostScript file to be printed. Initially, this 'logo.ps' file is blank. But, you can copy one of the existing SD logo files into this file with the commands:
      % cp sd_landscape.ps logo.ps (i.e., 1 grid horizontally per page)
    or
      % cp sd_portrait.ps logo.ps (i.e., 2 or 3 grids vertically per page)
    or
      % cp sd_quad.ps logo.ps (i.e., 4 grids horizontally per page)

    To erase the contents of this generic 'logo.ps' file, use the blank file, called 'blank.ps', with the following command:
      % cp blank.ps logo.ps

    This generic 'default_printer' script file must have the correct 'logo.ps' file already loaded prior to use and works satisfactorily when single format plots are used. However, time spent with the above copy commands can slow printing of multiple formats. In this case, multiple script files are needed to quickly change formats during printing. The files 'sd_logo_1', 'sd_logo_23' and 'sd_logo_4' can be selected from the Print Commands window to quickly utilize the correct logo for the desired format.

    To create your own logo or modify an existing logo, use the Sun Image Tool utility (accessed by: Workspace | Programs | Image Tool). The Image Tool can read files in other graphical format, such as TIFF, GIF and JPEG. Be sure to save your logo in a PostScript format file. The PostScript description must include the proper size location and orientation of the logo. A PostScript description normally includes the "showpage" command. You must edit the logo file to delete this command so that the logo and plot will appear on the same page. (Use the Text Editor, accessed by: Workspace | Programs | Text Edit, to open this PostScript file and then open the Find menu and select 'Find and Replace'. Type the text 'showpage' on the first line and then open the 'Find' menu and select 'Forward'. Delete the line and save the file. 'showpage' is often the last line of the PostScript file.) You may also need to modify the Graphic Position parameters in the Print Commands window to adjust the size and location of a plot in order for your logo to not overlap the plot.

  • dot

    Spectral Dynamics, Inc. 2730 Orchard Parkway, San Jose CA 95134-2012, tel: 408-678-3500, fax: 408-678-3580