Home
-> User's Manual -> Process Controller

Process Controller User Manual

Date: 12/1/10
Rev: 0.0.1
Authors: Bernard Alala and Joe Doll



Launching the Process Controller    -    The procedure for launching the process controller

The Socket Communication    -    Establishing communication between the programs

Integrating Pac-n-Zoom with External Programs    -    An example of how programs are used together

Launching the Python Script    -    The procedure for launching the python script

Debugging the Python Script    -    How to debug the python script

Communication    -    How the programs work together

Decoder Example    -    Decoder script and macro examples

Single Stepping Pac-n-Zoom Macros    -    How to single step macros



Introduction

    The process controller allows Pac-n-Zoom® to be a subroutine for another piece of software. Databases will be a subroutine for other programs, but they require a recompile of the routine that calls the database, and the database headers and libraries must be included in the recompile. It can be complicated and difficult. The process controller allows Pac-n-Zoom to be the subroutine of another program without any recompile. If the programmer wants to recompile, the programmer does not have to put Pac-n-Zoom headers and libraries into the compile. In fact, Pac-n-Zoom doesn't have any software components for the the programmer to include.

    At the present, the process controller provides much easier integration into existing systems than what other programs have (if they have anything). In the future, pervasive computing requires that various components integrate together without recompiles. Our process controller becomes essential in that environment.

Launching the Process Controller
    The process Controller can be used with Pac-n-zoom to run other applications. In the following example, the process controller controls the traffic and timing between Pac-n-Zoom and a python script.

Before the process controller is launched, the file, proccont.cfg, needs to be modified to hold the name of your computer. proccont.cfg is usually found in the same directory as the process controller. If the default path is taken during the process controller installation, the full path for proccont.cfg is:


" C:\Program Files\Colorcom\ProcessController\proccont.cfg".

proccont.cfg uses the standard Pac-n-Zoom data format.

The data segment named “SERVER DOMAIN NAME” needs to be modified to the name of your computer.


{
#SERVER DOMAIN NAME
THE NAME OF YOUR PC
*
}
Refer to the screen shot for help in finding the Computer Name.

Important! For the process controller to run successfully, you need to launch Pac-n-Zoom before launching the process controller.

The Socket Communication

    A communication socket has an IP address and a port number. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent.

    A server normally runs on a specific computer and has a socket that is bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request. On the client-side, the client knows the hostname of the machine on which the server is running and the port number on which the server is listening. If you are using a local machine as your server, you will use the name of your pc as the host name as shown in the above configuration (the proccont.cfg file). The server should listen to port 5099 which is assigned for Pac-n-Zoom and port 5098 that is assigned for the Process controller.

    To make a connection request, the client tries to connect with the server and port. The client also needs to identify itself to the server so it binds to a local port number that it will use during this connection. This is usually assigned by the system. If everything works fine, the server accepts the connection. If the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server. The client and server can now communicate by writing to or reading from their sockets.

Integrating Pac-n-Zoom with External Programs

    Python (or other scripting languages) can be used to integrate Pac-n-Zoom with other applications into a seamless automated solution.

    In the following example, 3 Pac-n-Zoom macros, db1.pzm, db2.pzm, and db3.pzm are integrated with the diff application to automate a test of Pac-n-Zooms encoder. The encoder creates PZH files (a testing and debug format) which are compared to known good (AKA "golden") PZH files.

db1.pzm: This Macro opens the bitmap files and save them as PZH files.

%AcceptableTolerance=2
%WriteGoldenFileFlag=0
Clearlib
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\Colorcom\files\rose-3.bmp")
SaveAs("c:\Users\Administrator\new_dir\rose-3.pzh")
Done()

; Test: Compare rose-3.pzh to pzh_gld\rose-3.pzh

%AcceptableTolerance=2
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\files\ppr-es.bmp")
SaveAs("c:\Users\Administrator\new_dir\ppr-es.pzh")
Done()

; Test: Compare ppr-es.pzh to pzh_gld\ppr-es.pzh

%AcceptableTolerance=2
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\files\r.bmp")
SaveAs("c:\Users\Administrator\new_dir\r.pzh")
Done()

; Test: Compare r.pzh to pzh_gld\r.pzh

%AcceptableTolerance=0
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\files\timrom41.bmp")
SaveAs("c:\Users\Administrator\new_dir\timrom41.pzh")
Done()

; Test: Compare timrom41.pzh to pzh_gld\timrom41.pzh

%AcceptableTolerance=0
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\files\mul-A.bmp")
SaveAs("c:\Users\Administrator\new_dir\mul-AB.pzh")
AddPage("c:\progra~1\colorcom\files\mul-B.bmp")
Done()

; Test: Compare mul-AB.pzh to pzh_gld\mul-AB.pzh

%AcceptableTolerance=0
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\files\mul-A.bmp")
SaveAs("c:\Users\Administrator\new_dir\mul-AD.pzh")
AddPage("c:\progra~1\colorcom\files\mul-B.bmp")
AddPage("c:\progra~1\colorcom\files\mul-C.bmp")
AddPage("c:\progra~1\colorcom\files\mul-D.bmp")
Done() Stop()

; Test: Compare mul-AD.pzh to pzh_gld\mul-AD.pzh


db2.pzm: The following macro generates the library files (A_ARL16.pzl, AB_ARL16.pzl and timrom41.pzl).

%CWD="c:\Users\Administrator\new_dir\"
%AcceptableTolerance=0
%WriteGoldenFileFlag=1
Clearlib
%NextBCGoldenFileName="A_ARL16"

Open("c:\\progra~1\colorcom\abc\A_ARL16.bmp")
SaveAs("c:\Users\Administrator\new_dir\A_ARL16.pzl")
Done()

%AcceptableTolerance=0
%WriteGoldenFileFlag=1
AddFile("A_ARL16")
%NextBCGoldenFileName="AB_ARL16"

Open("c:\\progra~1\colorcom\abc\AB_ARL16.bmp")
SaveAs("c:\Users\Administrator\new_dir\AB_ARL16.pzl")
Done()

%AcceptableTolerance=0
%WriteGoldenFileFlag=1
Clearlib
%NextBCGoldenFileName="timrom41"

Open("c:\\progra~1\colorcom\abc\timrom41.bmp")
SaveAs("c:\Users\Administrator\new_dir\timrom41.pzl")
Done()
Stop()

Timrom41.pzl (produced by the last macro, db2.pzm) is used in the next macro, db3.pzm, so make sure it is saved to the same path that is specified in db3.pzm.

db3.pzm: This Macro opens the bitmap files and save as *.pzh files.

%AcceptableTolerance=3
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\seg\ppr-es.bmp")
SaveAs("c:\Users\Administrator\new_dir\e-gld.pzh")
Done()

%AcceptableTolerance=3
%WriteGoldenFileFlag=0
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\seg\r.bmp")
SaveAs("c:\Users\Administrator\new_dir\r-gld.pzh")
Done()

%AcceptableTolerance=2
%WriteGoldenFileFlag=0
Clearlib
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\seg\dh_1.bmp")
SaveAs("c:\Users\Administrator\new_dir\dh_1.pzh")
Done()

%AcceptableTolerance=2
%WriteGoldenFileFlag=0
Clearlib
%NextBCGoldenFileName="timrom41"

Open("c:\progra~1\colorcom\seg\dh_1.bmp")
SaveAs("c:\Users\Administrator\new_dir\dh_1-10.pzh")
AddPage("c:\progra~1\colorcom\seg\dh_2.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_3.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_4.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_5.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_6.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_7.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_8.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_9.bmp")
AddPage("c:\progra~1\colorcom\seg\dh_10.bmp")
Done()
Stop()


These macros are then integrated by the master script to output the .pzh and .pzl test files that are tested against the known good files with the diff application which is external to Pac-n-Zoom.


# #############################
# Example Python Control Script
# #############################

# ================
# Import Libraries
# ================

import socket
import sys
import os
from time import strftime, sleep
# ===========
# Define Data
# ===========

# --------------------------
# Message Control Characters
# --------------------------

ExecuteTaskMessage = '#'
TaskCompletedMessage = '@'
OKMessage = '?'

# -------------
# Program Names
# -------------

PROCESS_CONTROLLER = 'ProcessController'
PAC_N_ZOOM = 'Pac-n-Zoom'

# --------------------
# Program Socket Ports
# --------------------

PC_PORT = '5098' # Character Script-ProcCont Port Number
I_PC_PORT = 5098 # Integer Script-ProcCont Port Number
PZ_PORT = '5099' # Character ProcCont-Pac-N-Zoom Port Number

# Use this to get Domain Name where Control Script is executing
CONTROL_SCRIPT_DOMAIN = socket.gethostname()

# Use this to get Control Script IP address
CONTROL_SCRIPT_IP = socket.gethostbyname(CONTROL_SCRIPT_DOMAIN)

pid = os.getpid()

PythonHeader = ': Python Script PID=%(pid)04d: ' % vars()

FileName = 'py__%(pid)04d.log' % vars()
flog = open(FileName, 'w')

# =========
# Functions
# =========

# -----------------------
def ScriptExit(ExitCode):
# -----------------------

# -----------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sPython Shutting Down\n' % vars())
flog.flush()
# -----------------------------------------------------------------

s.close()
flog.close()
sys.exit(ExitCode)

# -----------------------------------------
def PCSend(ProcessName, SendData, DoPrint):
# -----------------------------------------

while 1:
   try:
     # -------------------------------------------------------------------------------
     if DoPrint is 1:
       LogHeader = strftime('%X') + PythonHeader
       flog.write('%(LogHeader)sSending \"%(SendData)s\" to %(ProcessName)s\n' % vars())
     # -------------------------------------------------------------------------------
     s.send(SendData)
   except socket.error, msg:
     # ---------------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sProcess Controller Socket send() Error - Shutting Down\n' % vars())
     # ---------------------------------------------------------------------------------------
     ScriptExit(1)
   return

# ---------------------------------------
def PCSendMessage(ProcessName, SendData):
# ---------------------------------------

PCSend(ProcessName, SendData, 1)
RecvOKMessage(ProcessName)

# ---------------------------------------
def PCSendMacro(MacroName):
# ---------------------------------------

fmac = open(MacroName, 'r')

while 1:
   string = fmac.readline()
   if len(string) is 0:
     fmac.close()
     return
   PCSendMessage(PAC_N_ZOOM, string)

# ---------------------------
def ExecuteTask(ProcessName):
# ---------------------------

# ------------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sSending ExecuteTaskMessage to %(ProcessName)s\n' % vars())
# ------------------------------------------------------------------------------

PCSend(ProcessName, ExecuteTaskMessage, 0)

# ----------------------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sListening for TaskCompletedMessage from %(ProcessName)s\n' % vars())
# ----------------------------------------------------------------------------------------

RecvData = ' '
while 1:
   try:
     RecvData = s.recv(1024)
     if RecvData[0] is not TaskCompletedMessage[0]:
       # -------------------------------------------------------------------------------
       LogHeader = strftime('%X') + PythonHeader
       flog.write('%(LogHeader)sReceived \"%(RecvData)s\" from %(ProcessName)s\n' % vars())
       flog.write('%(LogHeader)sExpected TaskCompletedMessage - Shutting Down\n' % vars())
       # -------------------------------------------------------------------------------
       ScriptExit(1)
     # -----------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sReceived TaskCompletedMessage from %(ProcessName)s\n' % vars())
     # -----------------------------------------------------------------------------------
   except socket.error, msg:
     # ---------------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sProcess Controller Socket recv() Error - Shutting Down\n' % vars())
     # ---------------------------------------------------------------------------------------
     ScriptExit(1)
   return

# -----------------------------
def RecvOKMessage(ProcessName):
# -----------------------------

# -----------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sListening for OKMessage from %(ProcessName)s\n' % vars())
# -----------------------------------------------------------------------------

RecvData = ' '
while 1:
   try:
     RecvData = s.recv(1024)
     if RecvData[0] is not OKMessage[0]:
       # -------------------------------------------------------------------------------
       LogHeader = strftime('%X') + PythonHeader
       flog.write('%(LogHeader)sReceived \"%(RecvData)s\" from %(ProcessName)s\n' % vars())
       flog.write('%(LogHeader)sExpected OKMessage - Shutting Down\n' % vars())
       # -------------------------------------------------------------------------------
       ScriptExit(1)
     # ------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sReceived OKMessage from %(ProcessName)s\n' % vars())
     # ------------------------------------------------------------------------
   except socket.error, msg:
     # ---------------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sProcess Controller Socket recv() Error - Shutting Down\n' % vars())
     # ---------------------------------------------------------------------------------------
     ScriptExit(1)
   return
# ----------------------
def SendRecvOKMessage():
# ----------------------

RecvData = ' '

while 1:
   try:
     # ------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sSending OKMessage to Process Controller\n' % vars())
     # ------------------------------------------------------------------------

     s.send(OKMessage)

     # --------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sListening for OKMessage from Process Controller\n' % vars())
     # --------------------------------------------------------------------------------

     RecvData = s.recv(1024)
     if RecvData[0] is not OKMessage[0]:
       # ----------------------------------------------------------------------------------
       LogHeader = strftime('%X') + PythonHeader
       flog.write('%(LogHeader)sReceived \"%(RecvData)s\" from Process Controller\n' % vars())
       flog.write('%(LogHeader)sExpected OKMessage - Shutting Down\n' % vars())
       # ----------------------------------------------------------------------------------
       ScriptExit(1)
     break

   except socket.error, msg:

     # --------------------------------------------------------------------------------------------------------
     LogHeader = strftime('%X') + PythonHeader
     flog.write('%(LogHeader)sSleeping to give the Process Controller time to Open Socket and Respond\n' % vars())
     # --------------------------------------------------------------------------------------------------------

     sleep(1)

# ---------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sReceived OKMessage from Process Controller\n' % vars())
# ---------------------------------------------------------------------------

# ================
# End of Functions
# ================

# ==================
# Python Main Script
# ==================

# --------------------------------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sCreating Socket to communicate with the %(PROCESS_CONTROLLER)s\n' % vars())
# --------------------------------------------------------------------------------------------------

s = None
while 1:
   try:
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
   except socket.error, msg:
     s = None
     continue
   try:
     s.connect((CONTROL_SCRIPT_IP, I_PC_PORT))
   except socket.error, msg:
     s = None
     continue
   break

if s is None:
   # ----------------------------------------------------------------------------
   LogHeader = strftime('%X') + PythonHeader
   flog.write('%(LogHeader)sPython Socket Open Error - Shutting Down\n' % vars())
   # ----------------------------------------------------------------------------
   sys.exit(1)

# ---------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sConnected\n' % vars())
# ---------------------------------------------

#-----------------------------------------------------------
# Send and then Receive OKMessage to/from Process Controller
#-----------------------------------------------------------

SendRecvOKMessage()

# ---------------------------------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)s%(PROCESS_CONTROLLER)s has opened the socket for communications\n' % vars())
# ---------------------------------------------------------------------------------------------------

# -------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sPython can now talk to %(PAC_N_ZOOM)s\n' % vars())
# -------------------------------------------------------------------------

# ====================================================
# All processes are working, all sockets are open, and
# every process is listening on the proper socket.
# ====================================================

# -------------------------------------------------------------------------
LogHeader = strftime('%X') + PythonHeader
flog.write('%(LogHeader)sSending %(PAC_N_ZOOM)s Macro Messages\n' % vars())
# -------------------------------------------------------------------------

# ------------------------------------------------
os.system("dir") # example of a built-in dos call
# ------------------------------------------------

# -------------------------------------------------------------------------
# Test1.pzm
# ---------
# Example of the macro file test1.pzm passed through the Process Controller
# and then the dos executable diff.exe is called to compare the results.
# -------------------------------------------------------------------------

PCSendMacro("c:\progra~1\colorcom\Pac-n-Zoom\db1.pzm")

# ------------------------------------
# Tell Pac-n-Zoom to execute the Macro
# ------------------------------------

ExecuteTask(PAC_N_ZOOM)
# --> Pac-N-Zoom ExecuteTaskMessage
# <-- Pac-N-Zoom TaskCompletedMessage
z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\rose-3.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\rose-3.pzh")

if z is 0:
   flog.write('\nFiles rose-3.pzh and pzh_gld\rose-3.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\ppr-es.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\ppr-es.pzh")

if z is 0:
   flog.write('\nFiles ppr-es.pzh to pzh_gld\ppr-es.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\r.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\r.pzh")

if z is 0:
   flog.write('\nr.pzh and pzh_gld\r.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\timrom41.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\timrom41.pzh")

if z is 0:
   flog.write('\n timrom41.pzh and pzh_gld\timrom41.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\mul-AB.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\mul-AB.pzh")

if z is 0:
   flog.write('\n mul-AB.pzh and pzh_gld\mul-AB.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\mul-AD.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\mul-AD.pzh")

if z is 0:
   flog.write('\n mul-AD.pzh and pzh_gld\mul-AD.pzh are the same.\n\n')

# Test2.pzm
# ---------
# Example of the macro file test2.pzm passed through the Process Controller
# and then the dos executable diff.exe is called to compare the results.
# -------------------------------------------------------------------------

PCSendMacro("c:\progra~1\colorcom\Pac-n-Zoom\db2.pzm")

# ------------------------------------
# Tell Pac-n-Zoom to execute the Macro
# ------------------------------------

ExecuteTask(PAC_N_ZOOM) # --> Pac-N-Zoom ExecuteTaskMessage
# <-- Pac-N-Zoom TaskCompletedMessage
z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\A_ARL16.pzl", \
"c:\\Users\\Administrator\\pzh_gld\\A_ARL16.pzl")

if z is 0:    flog.write('\n A_ARL16.pzl and pzh_gld\A_ARL16.pzl are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\AB_ARL16.pzl", \
"c:\\Users\\Administrator\\pzh_gld\\AB_ARL16.pzl")

if z is 0:
   flog.write('\n AB_ARL16.pzl and pzh_gld\AB_ARL16.pzl are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\timrom41.pzl", \
"c:\\Users\\Administrator\\pzh_gld\\timrom41.pzl")

if z is 0:
   flog.write('\n timrom41.pzl and pzh_gld\timrom41.pzl are the same.\n\n')

# -------------------------------------------------------------------------
# Test3.pzm
# ---------
# Example of the macro file test3.pzm passed through the Process Controller
# and then the dos executable diff.exe is called to compare the results.
# -------------------------------------------------------------------------

PCSendMacro("c:\progra~1\colorcom\Pac-n-Zoom\db3.pzm")

# ------------------------------------
# Tell Pac-n-Zoom to execute the Macro
# ------------------------------------

ExecuteTask(PAC_N_ZOOM) # --> Pac-N-Zoom ExecuteTaskMessage
# <-- Pac-N-Zoom TaskCompletedMessage
z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\rose-3g.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\rose-3g.pzh")

if z is 0:
   flog.write('\n rose-3g.pzh and pzh_gld\rose-3g.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\e-gld.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\e-gld.pzh")

if z is 0:
   flog.write('\n e-gld.pzh and pzh_gld\e-gld.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\r-gld.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\r-gld.pzh")

if z is 0:
   flog.write('\n r-gld.pzh and pzh_gld\r-gld.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\dh_1.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\dh_1.pzh")

if z is 0:
   flog.write('\n dh_1.pzh and pzh_gld\dh_1.pzh are the same.\n\n')

z = os.spawnl(os.P_WAIT, "c:\\Users\\Administrator\\diff.exe", "diff", "-b", \
"c:\\Users\\Administrator\\new_dir\\dh_1-10.pzh", \
"c:\\Users\\Administrator\\pzh_gld\\dh_1-10.pzh")

if z is 0:
flog.write('\n dh_1-10.pzh and pzh_gld\dh_1-10.pzh are the same.\n\n')
ScriptExit(z)

ScriptExit(z)

ScriptExit(0)


Launching the Python Script

Launch Pac-n-Zoom
Launch Process Controller
Launch Python Script

To launch the python script from a DOS window, use the following sequence.
  1. Open the DOS window
  2. Change to the directory where Pac-n-Zoom is located.
  3. Type "Pacnzoom" in the DOS window. Pacnzoom should launch
  4. Leave Pac-n-Zoom open
  5. Launch the process controller
  6. Leave everything open and running. Then open a 3rd* DOS window.
  7. Launch the python script

The Macro will not run if the correct order is not followed.

*: The process controller opens the 2nd DOS window.

Debugging the Python Script

    After launching Pac-n-Zoom and the Process Controller, right click on python script icon, and choose "Edit with IDLE". Two Python windows will come up. From the Python Shell window, choose the Debug dropdown Debugger which will bring up a debug window. Check Source and Globals to see what you are stepping through.

    From the source window choose the Edit dropdown then click on Run. The debug window will stop on the first line of the script. The script has functions at the top which are best to jump over until you get below the line of Python Main Script.

Python is free, and you can get it from here.


Communication

    The master script calls the sub-program, and then passes the necessary macro instructions to the sub-program.

    The script system passes the sub-program macros to the process controller using the standard out. The process controller is a program that accepts the standard in and routes it to the selected sub-program via a socket. When the sub-program macro has finished, the process controller notifies the script system.


© 2004 - 2011 Accelerated I/O, Inc, All rights reserved.