@echo OFF
REM This script processes the bin files captured from the satellite for for one TPN for all of the seperate PIDs
REM It expects THREE parameters passed to it: 
REM First, (%1) the path to the master folder (normally BIN in the current directory) 
REM Second, (%2) the subfolder containing the individual PID_0x???? created by TSreader 
REM tHIRD (%3) A letter to be included with the accumulated tsv filename for this tpn to force sequencing in the final tsv file

REM The script is designed to run for each transponder, after it is captured

REM the following statement runs DSSTE for each PID in the folder, creating the corresponding .tsv file
@echo on

for %%f IN (%1\%2\PID_0x????.bin) do if %%~zf GTR 0 DSSTableExplorer.exe -batch -SkyM %%f

@REM the next statement assembles all of the individual tsv files into one file for the transponder
copy %1\%2\PID_0x????.tsv %1\accum%3_%2.tsv 2>&1

echo ==========TPN %2 Processing Completed >> %1\accum%3_%2.tsv
date /t >> %1\accum%3_%2.tsv
