Getting Started with ecpSE
What you will need
[This has changed a lot from the last version!]
There are several components from both NCS and Microsoft. These are ...
- Microsoft Windows 9x/NT/2000 (all development was done on Windows 2000).
- Microsoft Access. (I am working on interfacing with other Databases, but it may be a while.
Editing the ecpSEa files to do this shouldn't prove too difficult, though.)
If you are using an older version of Windows or Access it might not hurt to download the latest
MDAC (Microsoft Data Access Components) package.
- An NCS OpScan scanner (or any that will work with ScanTools 2.x. I have only tested on an OpScan 6.)
- ScanTools 2.x (I have only tested on 2.2, and even this has its instabilities.)
- SFWLink 1.2 or later (1.1 is probably too unstable) if you plan to interface ecpSE with ScanTools.
In addition to the OS, NCS hardware, and NCS software, you will need the Python interpreter. ecpSE is written in Python. Python is a free, object oriented, cross platform, scripting language. There are several components that you will need to download and install before ecpSE will run.
- The first is Python itself.
There are 4 ways to do this depending upon what version you plan on using.
- Python 2.0 Recommended (from Python.org)
The 2.0 distribution also contains Tcl/Tk which should be installed.
All installations should be to their default locations.
(Tk is a language used to create graphical user interfaces (GUI's) for Tcl (another language).
Python's extension of it is called Tkinter.
While this isn't necessary information to run ecpSE, it explains why Tcl/Tk must be installed.
It also will be necessary information if you decide to extend ecpSE.)
- ActivePython (from ActiveState)
The upside with this choice is that the win32all.exe download was included with this so the next step (Python's Windows extensions) is unnecessary.
The downside is that Tcl/Tk was not and must be downloaded separately.
To do this go here.
Also bug fixes will come slower to ActivePython.
- Python 1.6 (from Python.org)
The 1.6 distribution also contains Tcl/Tk which should be installed.
All installations should be to their default locations.
- Python 1.5.2 for scanners not supported by ecp_lnk.dll (see below) (from Python.org)
The 1.5.2 distribution also contains Tcl/Tk which should be installed.
All installations should be to their default locations.
Once this is complete look in C:\Program Files\Tcl\bin.
There you will find several files including Tcl80.dll and Tk80.dll.
Copy (don't cut) these files and paste them into C:\Program Files\Python\DLLs.
Why this is necessary (that is, why it is not handled by the installer) i am not sure (and it may not be on Win 9x), but I needed to do it before things would run correctly.
[If you want to use windll
(contained in the DynWin download) package from Sam Rushing to drive your NCS scanner (due to lack of ecp_lnk.dll support) download it too.
(for a smaller download use the calldll package [at your own peril] instead).
(It might be easier to edit the ecp_lnk source to include your scanner model.)
- You will also need Python's Windows extensions Win32all.exe
which is written by Mark Hammond (who also wrote the wonderful Python Programming on Win32).
Be sure to grab the latest version for the version of Python you are using (and if you downloaded ActivePython this was included).
Win32all also contains the PythonWin IDE should you decide to use Python for other projects.
- Third you should download the Pmw 0.8.4 package.
(In the Unix environment, which is where Python, Tcl and Tk all hail from, GUI items like text boxes and drop down lists are known as 'widgets'.
Pmw stands for 'Python Mega Widgets'.)
To install Pmw you will need a zip utility (like WinZip).
Extract the package into the Python directory.
(You must use the extract function.
If you try to simply drag and drop the files out of Pmw it will not work.)
- Lastly, if you intend to interface with SFWLink, you will need
ecp_lnk (recommended) or the
windll
(contained in the DynWin download) package from Sam Rushing (also recommended, but not necessarilly for this project)
(for a smaller download use the calldll package [at your own peril] instead).
Either of these will allow Python to communicate with sfwlnk32.dll and thus drive your NCS scanner.
[ecpSE really only uses ecp_lnk.dll anymore. If your scanner won't work with ecp_lnk and you want to
use windll you will need to edit ecpSEi.py.
My experience with calling sfwlnk32.dll via windll was not so good and had me rebooting and seeing blue screens a few times.
Only do this if a) you don't have access to VB and b) you are experienced with both Python and sfwLink
(why do i think that i am the only person that fits this description?).]
Installing ecpSE
Once you have done all of the above set-up, installing ecpSE is very easy.
- Download the source code.
(If you would like a slightly larger download you can also grab a
version complete with these docs.)
- Unzip ecpse.zip into your \Python\ directory.
This will create the folder \Python\ecpse\ which will contain the downloaded files.
- Create a directory in your root directory (C:\) called 'ecpse'.
- Create a directory in that directory called 'apps' ('C:\ecpse\apps').
- Make a reference to the Database object you will be using. To do this start PythonWin. Choose 'Tools | COM Makepy Utility'.
Select 'Microsoft DAO 3.6 Object Library (5.0)' (and any other DB interface you want to use like 'Microsoft ActiveX Data Objects Library').
[*If you are not using Access 2000 please see the customization options.]
Skipping this step will cause the program to use Late Binding instead of Early Binding of the Database objects.
All this means (probably) is that things will run a little slower.
- The last thing to do is to put sfwlnk32.dll somewhere.
I have found that having multiple copies of sfwlnk32.dll will not cause any problems
[in fact, if you use NCS software like Microtest-Q there will be a copy of sfwlnk32.dll in its directory
which does not conflict with other copies on your system]
and which ever one ecp_lnk finds first is the one it will use. Places that you might want to put the dll ...
first put it in \Python, then try \Python\PythonWin, lastly put it where ever ecp_lnk.dll
was compiled to.
Setting up ecp_lnk
This is one of those things that, if you know how to do this it isn't worth explaining, and if you don't, it will seem hoplessly complicated.
Place \ecp_lnk\ anywhere.
[If you download the source as a package with the other stuff it will be in the \Python\ecp_lnk\ directory.
The installer won't be available for a little while.]
Open ecp_lnk.vbp with Visual Basic 6.0 sp3 and select
File | Make ecp_lnk.dll
That's it. See the
ecp_lnk page for more details and for connecting ecp_lnk.dll to sfwlnk32.dll.
Installing ecpSEa (application files)
ecpSEa files are created by ecpSE. The program will allow you to choose where they are installed.
Instead of creating a single application file ecpSE creates a directory with three files including:
ecpSEa.py - the program that will scan/interpret your data
Paramlist.txt - editable instructions interpreted by ecpSEa.py
optionDB - parameters to control the layout of ecpSEa.py
Thus the directory that these 3 files reside in should have a unique name to identify them.
i.e. 'C:\ecpse\apps\My_App\'
Editing and Debugging
All of the files that make up ecpSE and ecpSEa can be edited with a simple text editor (Notepad is a bad choice and will cause problems.
PFE should work okay.). The PythonWin IDE is an excellent choice.
ecpSEi has a general
flow chart at the top of the
source.
Use this to familiarize yourself with the program's structure before editing.
So, to recap ...
download Python
download Win32all
download Pmw
download ecpSE (with docs), (without docs)
download ecp_lnk (installer), (source)