From 429064af6b54ce5d87c1a418118059dbc2c1d78a Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 3 Dec 2018 19:25:55 +0000 Subject: [PATCH] Output directly to the desstination folder so that output is not lost after partial completion. Add the ability to skip processing of some of the Folders Added logic to save the name of the folder if it contains reserved characters (space, dash, slash and backslash) --- PROMS/Baseline/AutomatedTesting.sql | 34 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/PROMS/Baseline/AutomatedTesting.sql b/PROMS/Baseline/AutomatedTesting.sql index 99d95971..acd4da64 100644 --- a/PROMS/Baseline/AutomatedTesting.sql +++ b/PROMS/Baseline/AutomatedTesting.sql @@ -37,9 +37,10 @@ ECHO AAA >%TEMP%\VEPROMS\NewFile.txt for %%a in (%TEMP%\VEPROMS\NewFile.txt) do Set fdt=%%~ta for /F "tokens=1,2,3,4,5,6 delims=/: " %%i in (''echo %fdt%'') do call:sc_FixTime %%k %%i %%j %%n %%l %%m set fdt=%fdt::=%_%GroupComment% -set ServerName=' + @@Servername + ' +set ServerName=' + @@Servername + ' md %TEMP%\VEPROMS\%fdt% -echo %date% %time% Start ' + @@Servername + ' ' + DB_NAME() + '%GroupComment% >>%TEMP%\VEPROMS\%fdt%\Times.txt +md C:\PDFs\%fdt% +echo %date% %time% Start ' + @@Servername + ' ' + DB_NAME() + '%GroupComment% >>C:\pdfs\%fdt%\Times.txt del %TEMP%\VEPROMS\NewFile.txt Rem Cleanup output folder before processing del %temp%\VEPROMS\*.txt @@ -50,13 +51,16 @@ if ERRORLEVEL 1 goto :oops Rem Update Formats call :sc_setformats unnecessary unnecessary ' + DB_NAME() + ' unnecessary %PROMSEXE% Rem Perform PROMS printing for each Folder ---------------------------------------- +GoTo :SkipStart +Rem Skip some DocVersions (Working Drafts) +:SkipStart ' declare @CommandLine nvarchar(255) declare Commands cursor for select 'Call :sc_PrintPDF %TEMP%\VEPROMS ' + cast(VersionID as varchar(5))+ ' ' + db_name() + ' ' + - Replace(Replace(ff.name,' ','_'),'-','_') + ' %PROMSEXE%' + Replace(Replace(Replace(Replace(ff.name,'/','_'),'\','_'),' ','_'),'-','_') + ' %PROMSEXE%' from docversions dv join folders ff on dv.folderID = ff.FolderID order by versionID @@ -69,10 +73,14 @@ BEGIN END CLOSE Commands DEALLOCATE Commands -PRINT 'Call :sc_MoveErrorLog ' + db_name() +' - -echo %date% %time% Done >>%TEMP%\VEPROMS\%fdt%\Times.txt -Move %TEMP%\VEPROMS\%fdt% C:\PDFs\%fdt% +PRINT 'GoTo :SkipEnd +Rem Skip Some DocVersions (Working Drafts) +:SkipEnd +Call :sc_MoveErrorLog ' + db_name() +' +Rem Record direcctly to C:\PDFs\%fdt% +echo %date% %time% Done >>C:\PDFS\%fdt%\Times.txt +Move %TEMP%\VEPROMS\%fdt%\*.* C:\PDFs\%fdt% +rd %TEMP%\VEPROMS\%fdt% set GroupComment= set fdt= @@ -86,23 +94,23 @@ timeout /T 10 goto:eof :sc_PrintPDF -echo %date% %time% Start %2 (%4) >>%TEMP%\VEPROMS\%fdt%\Times.txt +echo %date% %time% Start %2 (%4) >>C:\PDFS\%fdt%\Times.txt echo Creating PDFs for DocVersion %2 (%4) in %3 rem del %userprofile%\Documents\VEPROMS\%3*.txt "C:\PROMS\%5\VEPROMS.exe" /P=%2 /DB=%ServerName%:%3 /NT /NC rem ----------------------------------------------- rem Add /NW to exclude Word Output to the Meta File rem ----------------------------------------------- -echo %date% %time% Done %2 (%4) >>%TEMP%\VEPROMS\%fdt%\Times.txt +echo %date% %time% Done %2 (%4) >>C:\PDFS\%fdt%\Times.txt call :sc_AddText %3 %2 %4 %5 C: cd %1 if not exist DebugP*.txt goto:sc_PrintPDFNoFiles set fdt1=%fdt%\%3\%2_%4 -md %fdt1% +md c:\PDFs\%fdt1% del DOC_*.pdf > nul -move *.pdf %fdt1% > nul -move *.txt %fdt1% > nul +move *.pdf c:\PDFs\%fdt1% > nul +move *.txt c:\PDFs\%fdt1% > nul for /F %%c in (''cd'') do echo Files Moved to %%c\%fdt1% set fdt1= goto:eof @@ -131,7 +139,7 @@ echo %2/%3/%1 %5:%6 %4 %fdt% goto:eof :sc_MoveErrorLog -move %userprofile%\Documents\VEPROMS\%1*.txt %fdt%\%1 > nul +move %userprofile%\Documents\VEPROMS\%1*.txt C:\PDFS\%fdt%\%1 > nul goto:eof :sc_AddText