WAITFOR v1.3: program enabling automatically interchanging run of
	any dos-programs in 2 different application-windows 
	under WIN3.1 or WIN95
	Designed for use with m398 and m273 EG&G electrochemical software.
 
----> All questions to Evgenij Barsukov <evgen@camd1.kkpcr.re.kr>
                	P.O. Box 64 Yuseoung, Taejeon 305-600, Korea
		        Kumho Chemical Laboratories

This program enables automatically interchanging running 
autoexecute sequencies of m273 (EG&G INSTRUMENTS program for 
conventional electrochemical measurements) and m398 (EG&G
INSTRUMENTS program for impedance measurements).
For example, you can make a loop for galvanostatical reduction
for one hour, then potentiostatic EIS, than reducion again and so on
automatically.


INSTALLATION:
-----------------------
# a RAM-drive should be enabled, with at least 4 kb free memory
To do so, add a line:
device=ramdrive.sys 64 /e
in your config.sys file, and restart the computer.
# Copy waitfor.exe in both m398 and in m273 home directory.

Batch-files can be used in m398 and m273 autoexecute, 
pointing on waitfor.exe if it is placed in separate directory.

RUNNING THE INTERCHANGING AUTOEXECUTE - STEP BY STEP
-----------------------------------------------------
This description assumes, that your RAM-drive is D: and waifor
is in both m273 and m398 directories.

1. modify supplied with m273 and m398 *.pif files -- uncheck
in pif-eidtor "exclusive" and check "background"-check box.

2. make sure that *.pif - files are in c:\windows directory.

3. start both m273 and m398 programs in full-screen, before
you start any autoexecute. This step is important, because both
programs try to communicate with GPIB-driver, when started, and
would hang the system, if the driver is already in use. Never give
"edit setup" or "get setup" commands, when partner program is running 
in background - it would result in system error.

4. make an autoexecute sequence in m273 (example)
	1) =waitfor
	2) charge.set    filename
	3) =waitfor      -f
specify a loop 1-3, 10 cycles,
edit the electrochemical measurement setup and save it in charge.set	

5. change to m398 application window and make an autoexecute
	1) =waitfor
	2) long.set	eisname
	3) =waitfor	-f
specify a loop 1-3, 10 cycles, 
edit the impedance measurement setup and save it in long.set

6. change to m273 again and run it by "run autoexecute" command
WAITFOR will create a file "wait" in d: and terminate.
Measurement described in "charge.set" will start.

7. change to 398 and run autoexecute by "run autoexecute" command

WAITFOR will detect the presence of "wait" and go in waiting
state, checking every 10 second for wait to be removed by
m273, running in background.
Now the interchanging sequence will run automatically. You can
even change to any other window, because both programs are running
in background.

After end of the measurement "charge.set" WAITFOR -f ('give free mode')
removes the file "wait", then waits for 30 second for m398 to take control.
During this time, WAITFOR running in m398-window detects, that
"wait" is removed, creates it again, and terminate. Measurement
"long.set" starts.
WAITFOR -f in m273-window terminates and (loop) WAITWOR is executed. 
It detects "wait" from m398 and go in waiting state.

The measurement results are written in filename.00N and eisname.00N.

You can use an attached program MCONV.EXE to convert the multiple 
resulting files to plain ASCII format. Start MCONV without arguments 
to see the help-screen. Note that MCONV has a file-size restriction 
1000 points.

ADVANCED USE OF WAITFOR
------------------------------------------------------
The program can be started with following command-line
arguments:

# start program in \"give free\" mode <-f> def# \"launch\" mode
# path for your ram-drive <-dpath> def# d:\
path to a physical drive is OK, but slows down the process, because
the program have to access it every N second.

# check for file 'wait' every N second <-tN> def# N=10
# wait for partner-program to start, K second <-nK> def# K=30");

#  enable report in log-file <name.txt> def# none
This function allows to see, when the control was given from
one program to another. Useful for autoexecutes running many
days. Example: waitfor name.txt
 
# name, used to identify calling program in logfile: <-iname> def# waitfor
for example: log in by m398 at  Mon Apr 14 17:05:04 1997
if 'name' is m398.

  
COMMANDS IN "WAIT" MODE

# Push "s" to pause "wait" file checking till
you push s anew.

Description of operation: (techincal details - not necessary to read)
----------------------------------------------------

WAITFOR takes advantage of the fact, that above mentioned
EG&G programs communicate with GPIB-driver only during
measurement, and give it free after measurement. The
future of autoexecute-sequencies, allowing use of DOS-programs
as a command gives way for artifitial serial multitasking of
this programs, running parallely in different DOS-windows under 
WINDOWS 3.1.

There are several ways to make communication between 2 dos applications
under WINDOWS 3.1.  WAITFOR proceeds or queues the m398 or 
m273 autoexecute, checking   existence of file 'wait' on RAM-drive.

# there is two modes to start the program:
  "give free" and "launch"
# In 'launch' mode if there is NO 'wait' it creates it and terminates,
   giving way for the next step of autoexecute.
  If there is file 'wait, it goes in waiting state, checkning every N second
  for 'wait' to be removed by the partner-program.
  When 'wait' is removed, program creates it and terminates. 
# In 'give free' mode program removes 'wait', and check after K seconds
  if 'wait' is created by partner program. If 'yes',it goes in waiting state
  if 'no' - stops the whole process.

NOTE:
----------------
This utility is NOT supported by EG&G company. m398 and m273 software
are not supposed to be run in background or simultaneously, therefore some 
unexpected problems and even damages to the system may arise, although
never observed by me. 



**********************LICENCE AGREEMENT********************************
BY THE INSTALLATION OF WAITFOR OR MCONV ON ANY COMPUTER THE USER 
ACKNOWLEDGES AGREEMENT WITH ALL OF THE PROVISIONS OF THIS LICENSE.

WAITFOR  Copyright 1997 Evgenij Barsukov. All Rights Reserved.
MCONV Copyright 1997 Evgenij Barsukov. All Rights Reserved.

As freeware, WAITFOR and MCONV may be FREELY distributed to any person or 
institution expressly agreeing to abide by the conditions of this license. 
NO CHARGE may be made for any such distribution beyond the nominal cost of
the actual distribution media. The integrity of the package should be preserved.

The software m398 and m273 are copyright by EG&G INSTRUMENTS CORPORATION.
They are NOT freeware and are by NO means subject of this licence.

EVGENIJ BARSUKOV DISCLAIMS ALL WARRANTIES RELATING TO THIS SOFTWARE, 
WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, 
AND ALL SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED.
NEITHER EVGENIJ BARSUKOV NOR HIS EMPLOYERS NOR EG&G COMPANY WILL 
BE LIABLE FOR ANY INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE SUCH SOFTWARE. IN NO EVENT SHALL THE 
LIABILITY OF EVGENIJ BARSUKOV EVER EXCEED THE PRICE PAID FOR THE LICENSE 
TO USE THE SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE PERSON
 USING THE SOFTWARE BEARS ALL RISK AS TO THE QUALITY AND PERFORMANCE
 OF THE SOFTWARE.