REM -- H2XBMW.BAT - 24.3 PGO/BMW(ETK) INTFC - 1993OCT09PE/2002OCT31PE/2007JUN22VM
@ECHO Off
REM -- COPYRIGHT (C) 1993-1999,2000-2005 H.W.PETER, WUPPERTAL .DE --
REM -- COPYRIGHT (C) 1993-1999,2000-2005 PETER+GEISENDORF GMBH, SPROCKHOEVEL .DE --

REM -- EPCSENSE=*=C:\DCS2DSP\AMDSBMPP.000
REM -- EPCSENSE=*=C:\DCS2DSP\*.MK*
REM -- EPCSENSE=*=C:\DCS2DSP\*.SDR
REM -- EPCSENSE=*=C:\DCS2DSP\*.KSD
REM -- EPCSENSE=*=C:\BMW95\etk\bin\EPC_INT.MSG
REM -- EPCSENSE=*=C:\BMW95\htk\bin\EPC_INT.MSG
REM -- EPCSENSE=*=C:\ETK\EPC_INT.MSG
REM -- EPCSENSE=*=C:\temp\etk_*.
REM -- EPCSENSE=!
IF "%1"=="EPC" GOTO EPC
IF "%1"=="ETK" GOTO EPC

IF "%1"=="OQX" GOTO OQX
IF "%1"=="FT"  GOTO OQX

ECHO ----------------------------------------------------------
ECHO %0:
ECHO INVALID CONTEXT CALL
ECHO UNGUELTIGER AUFRUF
ECHO ----------------------------------------------------------
ECHO %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
PAUSE
GOTO ENDUP

REM 
REM -- H2XBMW.BAT - EPC/ETK ENTRY --

:EPC
rem -- %0=H2XBMW %1=EPC/ETK %2=homedisk %3=homepath %4=requestor(WHO)
rem -- %5=PC4xxxxx.PGO %6=station## %7=KA/SU/YA %8=HCode %9=IdentNr
rem -- PGOEPCPI process control for START /W prefix
rem -- PGOEPCDS EPC server name to aquire via network
rem -- PGOEPCDI actual EPC disk drive id (C:,D:,..)
rem -- PGOEPCDJ actual EPC subdirectory id
rem -- PGOEPCEX process control for exit (=END with W95 via H2XW95.BAT)

REM 
REM -- H2XBMW.BAT - W95/98 interface into local BMW W95 ETK --

:EPCLOC
:EPCLOCE
IF NOT "%PGONETID%"=="W95"                  GOTO EPCLOCEX
IF NOT EXIST C:\BMW95\sysadm\bin\SYSADM.EXE GOTO EPCLOCEX

SET PGOEPCDI=C:
SET PGOEPCDJ=BMW95\etk\bin
IF NOT EXIST %PGOEPCDI%\%PGOEPCDJ%\ETK.EXE  GOTO EPCLOCEX

REM -- execute EPC program --
%PGOEPCDI%
CD \
CD %PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
SET BMW_EPC=V$8,E!+
SET BWDTXT=E:\TXT
START /W /MAX ETK.EXE
:EPCLOCE4
CD \

REM -- switch back to home drive and home directory --
%2
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCLOCE6
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5 /V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCLOCE6
IF "%PGOEPCEX%"=="END" EXIT
GOTO EPCEND

:EPCLOCEX
REM 
REM -- H2XBMW.BAT - W95/98 interface into local BMW W95 HTK --

:EPCLOCH
IF NOT "%PGONETID%"=="W95"                  GOTO EPCLOCHX
IF NOT EXIST C:\BMW95\sysadm\bin\SYSADM.EXE GOTO EPCLOCHX

SET PGOEPCDI=C:
SET PGOEPCDJ=BMW95\htk\bin
IF NOT EXIST %PGOEPCDI%\%PGOEPCDJ%\HTK.EXE  GOTO EPCLOCHX

REM -- execute EPC program --
%PGOEPCDI%
CD \
CD %PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
SET BMW_EPC=V$8,E!+
SET BWDTXT=E:\TXT
START /W /MAX HTK.EXE
:EPCLOCH4
CD \

REM -- switch back to home drive and home directory --
%2
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCLOCH6
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5 /V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCLOCH6
IF "%PGOEPCEX%"=="END" EXIT
GOTO EPCEND

:EPCLOCHX
REM 
REM -- H2XBMW.BAT - MS-DOS interface into local BMW DOS ETK --

:EPCLOCS
SET PGOEPCDI=C:
SET PGOEPCDJ=ETK
IF NOT EXIST %PGOEPCDI%\%PGOEPCDJ%\BWD.EXE  GOTO EPCLOCSX
REM -- network type installation not processed here, --
REM -- but single user installation in network context --
IF     EXIST %PGOEPCDI%\%PGOEPCDJ%\DATA\*.* GOTO EPCLOCSX

REM -- execute EPC program --
%PGOEPCDI%
CD \
CD %PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
rem -- SET BMW_EPC=DINE273
SET BMW_EPC=V$8,E!+
SET BWDTXT=E:\TXT
BWD
:EPCLOCS4
CD \

REM -- switch back to home drive and home directory --
%2
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCLOCS6
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5 /V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCLOCS6
IF "%PGOEPCEX%"=="END" EXIT
GOTO EPCEND

:EPCLOCSX
REM 
REM -- H2XBMW.BAT - Novell NetWare 3.1x interface - preliminary approach --

rem -- greetings, mr. Piechatzek ! -- 1997MAR09/PE --
       GOTO EPCNW3X

:EPCNW3
IF NOT "%PGONETID%"=="NW3" GOTO EPCNW3X

REM -- quick&dirty attempt with fixed drive letters, O and G --
SET PGOEPCDI=O:
SET PGOEPCDJ=ETK
IF NOT EXIST %PGOEPCDI%:\%PGOEPCDJ%\BWD.EXE GOTO EPCNW3X

CD \
REM -- switch to remote EPC drive and directory --
REM *******************************************************
REM ** CAUTION: fixed term used to specify BWDTXT=G:\TXT **
REM *******************************************************

%PGOEPCDI%
CD \
CD \%PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
rem -- SET BMW_EPC=DINE273
SET BMW_EPC=V$8,E!+
SET BWDTXT=G:\TXT
BWD
:EPCNW34
CD \

REM -- switch back to home drive and home directory --
%2:
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCNW36
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5/V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCNW36
GOTO EPCEND

:EPCNW3X
REM 
REM -- H2XBMW.BAT - PGO Personal NetWare server (ZZ2) interface --

:EPCPNW
IF NOT "%PGONETID%"=="PNW" GOTO EPCPNWX
REM -- cannot process with PNW server, not enough main memory --
IF     "%PGONETMD%"=="SRV" GOTO EPCPNWX

C:
CD \
rem -- try to locate possible server cpu --
SET PGOEPCDI=C:
SET PGOEPCDJ=ETK
IF NOT EXIST %PGOEPCDI%\%PGOEPCDJ%\BWD.EXE GOTO EPCPNWX
CD \NWCLIENT
REM -- verify valid entry directory (CDROM) on any available server --
NET VLIST BMWE >NUL:
IF ERRORLEVEL 1 GOTO EPCPNWX
NET MAP Q: BMWE >NUL:
IF NOT EXIST Q:\INST_NET\INST_NET.EXE      GOTO EPCPNWU

REM -- switch to local EPC drive and directory --
REM -- internal parameters (BMW*.MFI) specify local or remote CDROM --
%PGOEPCDI%
CD \
CD %PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
rem -- SET BMW_EPC=DINE273
SET BMW_EPC=V$8,E!+
SET BWDTXT=E:\TXT
BWD
:EPCPNW4
CD \

REM -- switch back to home drive and home directory --
%2
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCPNW6
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5/V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCPNW6
NET MAP DEL Q: >NUL:
GOTO EPCEND

:EPCPNWU
NET MAP DEL Q: >NUL:
:EPCPNWX
REM 
REM -- H2XBMW.BAT - Win95 Netwk Mgr intfc for DOS ETK --

:EPCW95
IF NOT "%PGONETID%"=="W95" GOTO EPCW95X

C:
CD \
REM -- try to locate possible server cpu (\\BMW or \\PGO)
SET PGOEPCDI=C:
SET PGOEPCDJ=ETK
IF NOT EXIST %PGOEPCDI%\%PGOEPCDJ%\BWD.EXE GOTO EPCW95X

rem ****************************************************
rem -- If ETK CD is available as full copy on local HDD,
rem -- the subdirectory holding ETK CD is used by SUBST
rem -- instead of using NET USE for remote access --
IF NOT EXIST C:\BMWETKCD\ZZCD\ZZCD.EPS GOTO EPCW9510
NET USE  Q: /DELETE /YES   >NUL:
SUBST    Q: C:\BMWETKCD
GOTO EPCW952S
:EPCW9510
rem ****************************************************

rem -- learn mode: try to re-use previously found server --
SET PGOEPCDS=
IF EXIST %2%3\H2XBMW$0.BAT CALL %2%3\H2XBMW$0.BAT
IF "%PGOEPCDS%"=="" GOTO EPCW9512
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW9512
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW9512
rem -- learn mode: previously found server is now unavailable --
IF EXIST %2%3\H2XBMW$0.BAT DEL  %2%3\H2XBMW$0.BAT



rem -- contïed on next page --

REM 
REM -- H2XBMW.BAT - Win95 Netwk Mgr intfc for DOS ETK (contïed 1) --

rem -- search mode: try to locate an appropriate server --
SET PGOEPCDS=C00002
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951B
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW951B

SET PGOEPCDS=C00001
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951D
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW951D

SET PGOEPCDS=BMW
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW9514
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW9514

SET PGOEPCDS=PGOBMW
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951M
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW951M

SET PGOEPCDS=EPC
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951E
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW951E

SET PGOEPCDS=PGO
ECHO ... searching for %PGOEPCDS%
NET VIEW    \\%PGOEPCDS%   >NUL:
IF ERRORLEVEL 1 GOTO EPCW951P
NET USE  Q: /DELETE /YES   >NUL:
NET USE  Q: \\%PGOEPCDS%\E >NUL:
IF EXIST Q:\INST_NET\INST_NET.EXE GOTO EPCW952
IF EXIST E:\INST_NET\INST_NET.EXE GOTO EPCW952
:EPCW951P

rem -- contïed on next page --
REM 
REM -- H2XBMW.BAT - Win95 Netwk Mgr intfc for DOS ETK (contïed 2) --

NET USE Q: /DELETE /YES >NUL:
GOTO EPCW95X

:EPCW952
rem -- learn mode: establish service .BAT file entry for server found --
IF EXIST %2%3\H2XBMW$0.BAT GOTO EPCW952L
       ECHO SET PGOEPCDS=%PGOEPCDS%> %2%3\H2XBMW$0.BAT
:EPCW952L

:EPCW952S
REM -- switch to local EPC drive and directory --
REM -- internal parameters (BMW*.MFI) specify local or remote CDROM --
%PGOEPCDI%
CD \
CD %PGOEPCDJ%
REM > %5
IF EXIST %2%3\PC4%4.BMW COPY /B %2%3\PC4%4.BMW %PGOEPCDI%\%PGOEPCDJ%\%5 /V >NUL:
SET EPC_ACTION=NO_DATA
SET EPC_FILE=%PGOEPCDI%\%PGOEPCDJ%\%5
rem -- SET BMW_EPC=DINE273
SET BMW_EPC=V$8,E!+
SET BWDTXT=E:\TXT
BWD
:EPCW954
CD \



REM -- switch back to home drive and home directory --
%2
CD \
CD %3
IF NOT EXIST       %PGOEPCDI%\%PGOEPCDJ%\%5 GOTO EPCW956
COPY /B PC4FID.BMW+%PGOEPCDI%\%PGOEPCDJ%\%5 %5/V >NUL:
DEL                %PGOEPCDI%\%PGOEPCDJ%\%5
:EPCW956
REM ***************************************************
IF NOT EXIST C:\BMWETKCD\ZZCD\ZZCD.EPS GOTO EPCW9560
SUBST Q: /D
GOTO EPCEND
:EPCW9560
REM ***************************************************

NET USE Q: /DELETE /YES >NUL:
GOTO EPCEND

:EPCW95X
REM 
REM -- H2XBMW.BAT - EPC/ETK FINAL --

REM -- procedure may be extended here for a different context --
REM -- otherwise default to return to PGO mainline process --

ECHO ---------------------------------------------
ECHO %0:
ECHO CANNOT FIND EPC INSTALLATION        ...RETURN
ECHO ETK INSTALLATION NICHT ERREICHBAR   ...RETURN
ECHO ---------------------------------------------
PAUSE
GOTO EPCEND



:EPCEND
%2
CD \
CD %3
IF     EXIST      %5        GOTO EPCEND6
IF NOT EXIST %2%3\PC4%4.BMW GOTO EPCEND6
COPY /B PC4FID.BMW %5/V >NUL:
:EPCEND6
GOTO ENDUP
REM 
REM -- H2XBMW.BAT - OQX order queue transfer to BMW via Extranet --

:OQX
rem -- %0=H2XBMW %1=OQX/FT %2=homedisk %3=homepath %4=OQ*.BMW file id --

rem -- create valid directory entry for data export --
IF     EXIST C:\BMW_UPLD\DATEN\*.* GOTO OQX2
MD           C:\BMW_UPLD
MD           C:\BMW_UPLD\DATEN
:OQX2
CLS

rem -- post file(s) to transfer using BMW extranet convention --
:OQX4
IF     EXIST OQ*.BMW  GOTO OQX42
ECHO -------------------------------------------------
ECHO -- HINWEIS: 
ECHO -- Es stehen keine NEUEN Order-Bestaende zur
ECHO -- Uebertragung zur Verfuegung.
ECHO --
GOTO OQX46

:OQX42
IF     EXIST C:\BMW_UPLD\DATEN\AGMRULTV.TXT   DEL C:\BMW_UPLD\DATEN\AGMRULTV.TXT
REM                                            >  C:\BMW_UPLD\DATEN\AGMRULTV.TXT
IF NOT EXIST OQ*.BMW  GOTO OQX4X
FOR %%A IN  (OQ*.BMW) DO TYPE %%A              >> C:\BMW_UPLD\DATEN\AGMRULTV.TXT
DEL          OQ*.BMW
GOTO OQX46

:OQX46
DIR   C:\BMW_UPLD\DATEN\AGMRULTV.*
ECHO -------------------------------------------------
ECHO %0 - ET-Order:
ECHO -- Die zu uebertragende(n) Datei(en) finden Sie
ECHO -- auf diesem Computer
ECHO -- im Verzeichnis      C:\BMW_UPLD\DATEN\
ECHO -- unter dem Namen        AGMRULTV.TXT     (s.o.)
ECHO -- fuer den elektronischen Versand bereitgestellt
ECHO --                                      ...RETURN
ECHO -------------------------------------------------
PAUSE >NUL:
:OQX4X

rem -- try to call link procedure --
IF     EXIST H2XBMW.HTM GOTO OQX60
GOTO OQX68
:OQX60
rem ** might start MS IE instead of Netscape Nav - suspended 2003APR25PE(IBB)
rem ** reopened 2003MAY08PE(WDO)
START        H2XBMW.HTM
GOTO OQX68
:OQX68
CD \
GOTO OQXEND

:OQXEND
GOTO ENDUP
REM 
REM -- H2XBMW.BAT - FINAL --



:ENDUP
SET PGOEPCDS=
SET PGOEPCDI=
SET PGOEPCDJ=
SET EPC_ACTION=
SET EPC_FILE=
SET BMW_EPC=
SET BWDTXT=

REM -- now return to PGO home drive and resume PGO mainline --
%2
CD \
CD %3
SET  PGOEPCPI=PGOBEG
IF "%PGONETID%"=="W10" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGONETID%"=="W16" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGONETID%"=="W95" SET PGOEPCPI=START /R /MAX PGOFFICE.PIF
IF "%PGOEPCEX%"=="END" SET PGOEPCPI=
%PGOEPCPI%
EXIT
