Re: [foxboro] printscreen script

  • From: "Joseph M. Riccardi" <joe@xxxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Mon, 27 Aug 2007 16:25:38 -0400

Pat,

Thanks for the script.  Sorry I did not mention that I am working on a UNIX
box using DMs.  We are just starting the evolution to Windows; thus the need
for all of the printscreens to redraw in FoxDraw.  

I did make a feeble attempt to UNIXize your 1st script (i.e., deleted the
.fdf reference, etc.) but failed miserably.  1st, it did not even create the
FILE file, so I created it manually (still did not work).  2nd, the pref
command is not working because the display is not getting called up, so I
entered the pwd manually (still did not work). 3rd, I gave up and am writing
this response.  Initially, I received a 'do' error, then a "can't get glbl"
error, blah, blah, blah.

Can we start all over again with a UNIX script.  I don't have a need for the
.pdf stuff any ways.  Sorry, but I do not know the script language very
well...

I would appreciate it.  Thanks.


Joseph M. Riccardi, Inc.
DCS Services - Industrial Process Control
 
Joe@xxxxxxxxxxxxx
 
"To give real service you must add something that cannot be bought or
measured with money; and that is sincerity and integrity." - Donald A. Adams
 

-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On
Behalf Of Pat Martens
Sent: Monday, August 27, 2007 2:39 PM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] printscreen script


Joseph

Below you can find a small script which allows you to print 1 directory of
.fdf files.

I recently installed a adobe .pdf printer driver on our Foxboro terminal
server (it works on XP 7.1 as well) which allows us to print all our
graphics into one (or several, or one/graphic) .pdf file. This save us a lot
of paper!

I tried several pdf printer drivers (some of them did not work on the
terminal server) but ended up with pdf995 which has some nice features.
Also you can manipulate the corresponding .ini file for this driver so it
allows me to set destination path and filename options for the created .pdf
from a script. See below for an example.


First the simple script. Should work with any installed printer. 

Change directory to where your .fdf files are and run this script


#!/bin/sh

echo "Make sure FoxView is in fullview!"
echo "Minimise this window!"

sleep 5

for FILE in `ls *.fdf`
#for FILE in `ls u221_[0][0][0-1]T.fdf`
#for FILE in `ls u309_000.fdf`
do      
        echo "/usr/local/pref -$DMNAME dmcmd `pwd`/$FILE"
        # call up the display
        /usr/local/pref -$DMNAME dmcmd `pwd`/$FILE
        # allow some display call-up time
        sleep 5
        # print the display
        /usr/local/pref -$DMNAME dmcmd psc
        # allow some time for the printer to print
        # if you print to fast, the /var partition might
        # fill with printer spool files!
        sleep 22
done


Now the script which requires a windows box and pdf995 driver installed.
You could pass a display manager name as a parameter so the actual call-up
of displays will take place on a remote screen (or if you start it from a
remote terminal, call them on the local screen). In any case, make sure the
corresponding display manager is maximised and not overlapped with other
windows!
You will most likely need to adapt the script as it is based on our display
naming conventions. The problem I had with this is that the printer spooler
only gives the first 4 characters of the filename so I had to find a way to
make sure unique files were printed if each graphic was printed to a
separate .pdf file.


#!/bin/sh

TMP_DIR=/opt/trn/tools/tmp/PrintAllMimics
PDFINIT=c:/pdf995/res/pdf995.ini
PDFDIR=\printouts
PDFDIRUNIX=/printouts


pdf995_init()
{
echo "[Parameters]" > $PDFINIT
echo "Quiet=0" >> $PDFINIT
echo "Install=1" >> $PDFINIT
echo "Use GPL Ghostcript=1" >> $PDFINIT
echo "Output File=SAMEASDOCUMENT" >> $PDFINIT
echo "Output Folder=D:\\$PDFDIR\\$UNIT" >> $PDFINIT
echo "Size=a4       8.3   11.7" >> $PDFINIT
echo "Autolaunch=0" >> $PDFINIT
echo "Stationery File=Stationery" >> $PDFINIT
}

echo "Make sure FoxView is in fullview!"
sleep 2

# check for specified DMNAME
if [ $# -lt 1 ]
then
        DM=$DMNAME
else
        DM=$1
fi

# For all .fdf files in this directory
for FILE in `ls *.fdf`
#for FILE in `ls u221_[0][0][0-1]T.fdf`
#for FILE in `ls u309_000.fdf`
do
        # remove the unit number prefix from the filename
        MIMICNR=`basename $FILE | cut -f2 -d'_'`
        MIMIC=`basename $FILE`
        # get the u309 prefix from the filename
        UNIT=`basename $FILE | cut -f1 -d'_'`
        # create a subdirectory per unit
        if [ ! -d /$TMP_DIR/$UNIT ]
        then
                mkdir -p $TMP_DIR/$UNIT
        fi
        if [ ! -d $PDFDIRUNIX/$UNIT ]
        then
                mkdir -p $PDFDIRUNIX/$UNIT
        fi
        # copy the u309_000.fdf file the a temp directory.
        # put it in subdir u309 and call it 000.fdf
        cp $MIMIC $TMP_DIR/$UNIT/$MIMICNR
        echo "/usr/local/pref -$DM dmcmd $TMP_DIR/$UNIT/$MIMICNR"
        /usr/local/pref -$DM dmcmd $TMP_DIR/$UNIT/$MIMICNR
        # set the ini parameters for the pdf995 driver
        pdf995_init
        sleep 5
        /usr/local/pref -$DM dmcmd psc
        # printer spooler needs to be empty before next graphic
        # is printer else pdf995_init will not work correctly
        # (it would use settings for the previous graphic)
        sleep 5 
done



Kind regards,
Patrick Martens
Total Raff. Ned. N.V.


-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On
Behalf Of Joseph M. Riccardi
Sent: maandag 27 augustus 2007 19:49
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] printscreen script

Folks,
I need printscreens of all displays in the entire plant for documentation
(/usr/disp/*/*).  I searched the archives and found the command to call up a
single display and the printscreen command (/usr/local/pref -DMNAME DMCMD
"dmcmd psc").  Anybody out there already have a script to do it for an
entire directory and/or subdirectories of displays?  I would guess the
script should also include some sort of sleep time inserted between display
call ups; no?

I would appreciate the help.

Thanks.

Joseph M. Riccardi, Inc.
DCS Services - Industrial Process Control
 
Joe@xxxxxxxxxxxxx
 
"To give real service you must add something that cannot be bought or
measured with money; and that is sincerity and integrity." - Donald A. Adams
 



-- No attachments (even text) are allowed --
-- Type: application/ms-tnef
-- File: winmail.dat


 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: