#!/bin/csh
# File Name:    post_cdr14
# File Purpose: This file is a c-shell script that is called after any output
#               using the Orbotech AOI interface is performed. It can be used
#               to post process the AOI files in any way required.
# Written by:   Ian Ticehurst (Autom8 Ltd.)
# Version 1A.:  Date: 17.08.00 - Initial design and development.
# Version 1B.:  Date: 06.09.00 - Inclusion of example 3 provided by CB (Orbotech).
# version 1C.:  Date: 27.10.00 - Addition of $TMP definition and useage.
# Version 1D.:  Date: 05.12.00 - Removal of "gui" alias.
############################# Start of notes ###############################
# This file is called whenever any output is created using the CDR (AOI) interface.
# The function is ver similar to the post_output hook, except that this hook is
# only called by the AOI output from the CDR interface. It is called after the
# file(s) have been created. As this hook is a c-shell script it can perform any
# action required. It gets passed a single parameter, which is the name of a file
# that should be sourced. This will import the following variable:-
#    $CDR14_AFFECTED - set to the list of affected layers.
# In addition to this the script can also use the environment variables $JOB, $STEP,
# $AOIPROG_DIR and $AOIIMG_DIR. Thus it is possible to create a program which can
# perform many functions dependent on the step being output, the affected layers
# etc.
# Some simple example functions are written below, however all the lines have been
# commented out to avoid the script running everytime the output is used. In order
# to see how each section works simply remove the coment (#) marker from the start
# of the code lines (take care not to remove this character from real comment lines).
############################# End of notes ###############################
# Define correct temp. dir. depending on env. vars.
if ($?GENESIS_TMP) then
	set TMP = $GENESIS_TMP
else if ($?GENESIS_DIR) then
	set TMP = $GENESIS_DIR/tmp
else
	set TMP = /genesis/tmp
endif

# Set up gui data and response files
set GUI_DATA = $TMP/gui_data.$$
set GUI_RESP = $TMP/gui_resp.$$

# Source the system created file (set the CDR14_AFFECTED variable).
source $1

## Example One - Put a window on screen showing the variables used.
#echo "WIN 200 200" >> $GUI_DATA
#echo "FONT tbr14" >> $GUI_DATA
#echo "BG 222299" >> $GUI_DATA
#echo "FG 999999" >> $GUI_DATA
#echo "LABEL Frontline Default Hook Pop-up" >> $GUI_DATA
#echo "LABEL This is the default hook post_cdr14" >> $GUI_DATA
#echo "LABEL It is located in $GENESIS_DIR/sys/hooks" >> $GUI_DATA
#echo "LABEL The hook is designed to perform actions after output of CDR data" >> $GUI_DATA
#echo "LABEL Comments and possible applications can be found in the header of this hook" >> $GUI_DATA
#echo "LABEL Also see the hooks readme file and on-line manual 0203 (chapter 9) for more details" >> $GUI_DATA
#echo "FONT tbi14" >> $GUI_DATA
#echo "BG 883355" >> $GUI_DATA
#echo "LABEL EXAMPLE SECTION ONE..............." >> $GUI_DATA
#echo "LABEL Variables available to this hook are:-" >> $GUI_DATA
#echo "LABEL JOB is set to $JOB" >> $GUI_DATA
#echo "LABEL STEP is set to $STEP" >> $GUI_DATA
#echo "LABEL AOIPROG_DIR is set to $AOIPROG_DIR" >> $GUI_DATA
#echo "LABEL AOIIMG_DIR is set to $AOIIMG_DIR" >> $GUI_DATA
#echo "LABEL CDR14_AFFECTED is set to $CDR14_AFFECTED" >> $GUI_DATA
#echo "FONT tbr14" >> $GUI_DATA
#echo "BG 222299" >> $GUI_DATA
#echo "END" >> $GUI_DATA

#gui $GUI_DATA
#\rm $GUI_DATA

## Example Two - List all output files that have been created.
## Create window to display file list.
#echo "WIN 200 200" >> $GUI_DATA
#echo "FONT tbr14" >> $GUI_DATA
#echo "BG 222299" >> $GUI_DATA
#echo "FG 999999" >> $GUI_DATA
#echo "LABEL Frontline Default Hook Pop-up" >> $GUI_DATA
#echo "LABEL This is the default hook post_cdr14" >> $GUI_DATA
#echo "LABEL It is located in $GENESIS_DIR/sys/hooks" >> $GUI_DATA
#echo "LABEL The hook is designed to perform actions after output of CDR data" >> $GUI_DATA
#echo "LABEL Comments and possible applications can be found in the header of this hook" >> $GUI_DATA
#echo "LABEL Also see the hooks readme file and on-line manual 0203 (chapter 9) for more details" >> $GUI_DATA
#echo "FONT tbi14" >> $GUI_DATA
#echo "BG 883355" >> $GUI_DATA
#echo "LABEL EXAMPLE SECTION TWO..............." >> $GUI_DATA
#echo "LABEL Output files are:-" >> $GUI_DATA
#echo "LABEL Files in $AOIPROG_DIR are:-" >> $GUI_DATA
#ls $AOIPROG_DIR >> $GUI_DATA
#echo "LABEL Files in $AOIIMG_DIR are:-" >> $GUI_DATA
#ls $AOIIMG_DIR >> $GUI_DATA
#echo "FONT tbr14" >> $GUI_DATA
#echo "BG 222299" >> $GUI_DATA
#echo "END" >> $GUI_DATA

#gui $GUI_DATA
#\rm $GUI_DATA

## Example Three - Transfers the AOIPROG and AOIIMG files to the refmanager station using ftp transfer. 
##(this is useful when running Genesis under Windows NT because NFS is not required).
## Set up the variables required for access to the refmanager station.	
#set REFMGR_STATION = "cdrdemo"
#set REFMGR_USERNAME = "acn"
#set REFMGR_PASSWORD = "acn"
#set REFMGR_CIMDIR = "/usr/refmgr/cim"

#cd $AOIPROG_DIR
#foreach affected ($CDR14_AFFECTED)
## NOTE - Do not indent the following section!
## Logon on using ftp and transfer the files.
#ftp -i -n << END 
#open $REFMGR_STATION
#user $REFMGR_USERNAME $REFMGR_PASSWORD
#cd ${REFMGR_CIMDIR}/aoiprog
#put $affected
#cd ../aoiimg
#lcd ../aoiimg
#put $affected
#bye
#END
#cd ../aoiprog
#end

abort:

exit 
############################ END OF PROGRAM #####################