@ECHO OFF


goto agreement

echo remove latency monitor, music, etc (non-redistributable) before going to public - ok for Mark and Mack.
echo .
echo Search replace daw-setup.log with percent-SetupLog-percent as last item before testing.
echo .
echo use menu system to allow selective installs ?
echo .
echo add   > nul  to almost all commands
echo add  something on screen to show progress.
echo .
echo still need to wget the video files that are created
echo .
echo delete as much stuff as possible when this done.
echo .
echo . For Vista/7 - running bat as Administrator assumes administrator account is disabled 
echo . otherwise all references (in all scripts) to %USERPROFILE% will resolve to administrator and not user.


:agreement
 cls
 echo ****************************************************************************
 echo ** daw-setup,bat is a wrap-around installer that allows you to quickly    **
 echo ** and easily install and configure the following items:                  **
 echo **     Kristal Audio Engine, Audacity 1.2.6, Audacity 1.3.14,             ** 
 echo **     RazorLame 115a, ASIO4All 2.10, VST Plugins,                        **
 echo **     LDASPA 0.4.15 for Audacity, and Lame MP3 Encoder.                  **
 echo **                                                                        **
 echo ** Each application is then configured with popular or time-saving options**
 echo ** This saves you the hassle of editing preferences and hacking the       **
 echo ** registry to configure the applications in an easy to use manner        **
 echo **                                                                        **
 echo ** If you have any of these applications already installed you will be    **
 echo ** given an option to uninstall/reinstall or to simply configure the      **
 echo ** optional components without reinstalling the application               **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 pause > nul
 cls
 echo ****************************************************************************
 echo ** daw-setup.bat is in no way associated with any of the software it      **
 echo ** installs and does not intentionally infringe on any license agreements **
 echo **                                                                        **
 echo ** daw-setup.bat is written to support Win9x/ME/2000/XP/Vista/7           **
 echo **                                                                        **
 echo ** daw-setup.bat is provided as is and has no warranty or support         **
 echo **                                                                        **
 echo ** There is no guarentee that daw-setup.bat will work on your computer    **
 echo **                                                                        **
 echo ** While this script makes every attempt to back up files that it changes **
 echo ** you should perform a full system backup before running this script     **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **          Press 1 to accept these terms and run the script              **
 echo **                                                                        **
 echo **          Press 2 to exit this script                                   **
 echo **                                                                        **
 echo ****************************************************************************
 choice /c:12
 if errorlevel 2 exit
 if errorlevel 1 goto Begin-Housekeeping


:Begin-Housekeeping
if ".%~dp0%"=="." goto not-uac-admin
goto uac-admin


:not-uac-admin
Set StartInstall=%CD%
goto more-Begin-Housekeeping


:uac-admin
%~d0%
cd %~dp0%
Set StartInstall=%~dp0%
Set StartInstall=%StartInstall:~0,-1%
goto more-Begin-Housekeeping


:more-Begin-Housekeeping
Set Success=yes
set CurrentStamp=%date:/=-% %time::=%
Set SetupLog=%StartInstall%\daw-setup.%CurrentStamp%.log
Set VersionFile=_version1.0

echo . >> "%SetupLog%"
echo ------------------------------------------------ >> "%SetupLog%"
echo Begin Install %date% %time% >> "%SetupLog%" 
echo Installer started in %StartInstall% >> "%SetupLog%"
echo ------------------------------------------------ >> "%SetupLog%"
echo . >> "%SetupLog%"

echo StartInstall = %StartInstall% >> "%SetupLog%"
echo SetupLog = %SetupLog% >> "%SetupLog%"
echo Success = %Success% >> "%SetupLog%"
echo CurrentStamp = %CurrentStamp% >> "%SetupLog%"
echo VersionFile= %VersionFile% >> "%SetupLog%"

:Set-PF-Folder
 :64bit-check
  echo 64bit-check OS >> "%SetupLog%"
  if "%ProgramFiles(x86)%."=="." goto 32-bit-set
  set ProgFiles=%ProgramFiles(x86)%
  echo 64-bit OS. Program Files folder is set to %ProgFiles% >> "%SetupLog%"
  goto Set-Doc-Folder

 :32-bit-set
  echo 32-bit-set OS >> "%SetupLog%"
  set ProgFiles=%ProgramFiles%
  echo 32-bit OS. Program Files folder is set to %ProgFiles% >> "%SetupLog%"
REM User entered folder not supported until can handle odd number of quotes or instructions are explicit about quotes
REM So much testing has been done on this that code below cannot be trusted (even though it worked earlier in all cases except where user entered an odd number of quotes).
REM Migrate from using a parameter to asking them to enter the directory then can loop through until they get it right or exit.
REM Also need to add instruction that the folder must already exist.
REM When this function is added also need to change display text in the bad-folder-menu section.
REM  goto Set-Doc-Folder
  goto Win7-Check


:Set-Doc-Folder
 echo Set-Doc-Folder >> "%SetupLog%"

 :User-entered
 Set DocTemp=f%1%l
 Set DocRmvd=

  if [^%DocTemp:~1,1%]==[^"] (
     Set DocTemp=%DocTemp:~2%
     Set DocRmvd=f
     )

  if [^%DocTemp:~-2,1%]==[^"] (
     Set DocTemp=%DocTemp:~0,-2%
     Set DocRmvd=%DocRmvd%l
     )

  if %DocRmvd%.==. goto Win7-check

:f-check
  if %DocRmvd%==f (goto f-gone) else (goto l-check)
 :f-gone
  Set DocFolder=%DocTemp:~0,-1%
  goto set-user-entered


:l-check
  if %DocRmvd%==l (goto l-gone) else (goto fl-gone) 
 :l-gone
  Set DocFolder=%DocTemp:~1%
  goto set-user-entered


:fl-gone
  Set DocFolder=%DocTemp%
  goto set-user-entered

  
 :set-user-entered
  echo Setting User Entered Install Folder >> "%SetupLog%"
 :usr-loop
   SHIFT
   Set DocTemp=%1
   if [^%DocTemp:~0,1%]==[^"] Set DocTemp=%DocTemp:~1%
   if [^%DocTemp:~-1%]==[^"] Set DocTemp=%DocTemp:~0,-1%
   if %DocTemp%.==. goto rmv-backslash-and-quotes
   SET DocFolder=%DocFolder% %DocTemp%
  goto usr-loop

 :rmv-backslash-and-quotes
  echo User Entered Folder shown on next line will be missing if user used only one quote >> "%SetupLog%"
  echo User Entered Folder is %DocFolder% >> "%SetupLog%"
  if %DocFolder:~-1%==\ SET DocFolder=%DocFolder:~0,-1%
  if [^%DocFolder:~-1%]==[^"] Set DocFolder=%DocFolder:~0,-1%
  echo Modified User Entered Folder is %DocFolder% >> "%SetupLog%"
  if not %DocFolder:~1,1%==: goto bad-drive
  set DocDrive=%DocFolder:~0,2%
  if exist "%DocFolder%\." goto log-doc-folder
  echo Could not find user entered folder %DocFolder%, Ask User to continue >> "%SetupLog%"

 :bad-drive
 :bad-usrfolder-menu
   cls
   echo ****************************************************************************
   echo **                                                                        **
   echo **                             Major Problem!                             **
   echo **                                                                        **
   echo **             The Setup program can not find the directory               **
   echo **  %DocFolder%
   echo **                                                                        **
   echo **                                                                        **
   echo **                                                                        **
   echo **                                                                        **
   echo ****************************************************************************
   echo **                                                                        **
   echo **          Press 1 to see how to give the Installer a specific           **
   echo **       directory to use and then exit the Installer to try again        **
   echo **                                                                        **
   echo **          Press 2 to let the Installer look for your Default            **
   echo **    Documents (Vista/Win7) or My Documents (Win9x/WinXP) directory      **
   echo **                                                                        **
   echo ****************************************************************************
   choice /c:12
   if errorlevel 2 goto Win7-check
   if errorlevel 1 goto display-user-entered


:Win7-check
  echo Win7-check >> "%SetupLog%"
  if exist "%USERPROFILE%\Documents\." goto Win7-set
  goto WinXP-check

  :Win7-set
   echo Win7-set >> "%SetupLog%"
   set DocFolder=%USERPROFILE%\Documents
   set DocDrive=%DocFolder:~0,2%
   goto log-doc-folder


:WinXP-check
  echo WinXP-check >> "%SetupLog%"
  if exist "%USERPROFILE%\My Documents\." goto WinXP-set

  :bad-folder-menu
    cls
    echo ****************************************************************************
    echo **                                                                        **
    echo **                             Major Problem!                             **
    echo **                                                                        **
    echo **                 The Setup program can not find your                    **
    echo **     Documents (Vista/Win7) or My Documents (Win9x/WinXP) directory     **
    echo **                                                                        **
    echo **                                                                        **
    echo **                                                                        **
    echo **                       The Installer is exiting                         **
rem     echo **                 The Next screen will tell you how to                   **
rem     echo **            give the Installer a specific directory to use              **
    echo **                                                                        **
    echo **                                                                        **
    echo **                                                                        **
    echo **                                                                        **
    echo **                                                                        **
    echo ****************************************************************************
    echo **                                                                        **
    echo **                       Press any key to continue                        **
    echo **                                                                        **
    echo ****************************************************************************
    pause > nul
    Set Success=no
    goto display-user-entered


  :WinXP-set
   echo WinXP-set >> "%SetupLog%"
   set DocFolder=%USERPROFILE%\My Documents
   set DocDrive=%DocFolder:~0,2%
   goto log-doc-folder


:log-doc-folder
 echo log-doc-folder >> "%SetupLog%"
 echo DocFolder (Installation Folder) is set to %DocFolder% >> "%SetupLog%"
 echo DocDrive (Installation Drive) is set to %DocDrive% >> "%SetupLog%"


:desktop-check
 echo Confirm Path to Desktop is valid >> "%SetupLog%"
 if exist "%USERPROFILE%\Desktop\." goto MyDoc-check
 cls
 echo Something broke at User Desktop Path check - Exiting Install >> "%SetupLog%"
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                    Failed to Find User Desktop                         **
 echo **                                                                        **
 echo **                                                                        **
 echo **                          Exiting Install                               **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 Set Success=no
 goto end


:MyDoc-check
 echo Confirm Documents folder exists and env variable %DocFolderS% is correct >> "%SetupLog%"
 if exist "%DocFolder%\." goto wget-check
 cls 
 echo something broke at My Documents Path check - Exiting Install >> "%SetupLog%"
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                 Failed to Set DocFolderS variable                      **
 echo **                                                                        **
 echo **                                                                        **
 echo **                          Exiting Install                               **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 Set Success=no
 goto end


:wget-check
 echo Confirm wget exists >> "%SetupLog%"
 if exist "%StartInstall%\wget.exe" goto ask-ok-to-go
 cls 
 echo can't find wget.exe (wget-check) - Exiting Install >> "%SetupLog%"
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **              Failed to Find wget.exe in Startup Folder                 **
 echo **                                                                        **
 echo **                                                                        **
 echo **                          Exiting Install                               **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 Set Success=no
 goto end


:ask-ok-to-go
 echo Asking user if ok to continue >> "%SetupLog%"
 cls 
  echo ****************************************************************************
  echo **                                                                        **
  echo **                           Ready To Install!                            **
  echo **                                                                        **
  echo **                  The Installation folder is set to                     **
  echo **  %DocFolder%\_My Songs
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **                                                                        **
  echo **              Press Y to accept this folder and continue                **
  echo **              Press N to stop the installation                          **
  echo **                                                                        **
  echo ****************************************************************************
  choice
  if errorlevel 2 goto end
  if errorlevel 1 goto wget-mysongs


:wget-mysongs
 REM  Don't use the reusable download script for this particular download
 REM  because it does not yet exist in the local PC.
 REM
 echo Downloading MySongs archive - skips to Mid-Housekeeping if %VersionFile% is found >> "%SetupLog%"
 if exist "%DocFolder%\_My Songs\_Setup\Utils\%VersionFile%" goto Mid-Housekeeping
 cls
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                 Downloading Initial Setup Archive file                 **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo Confirm mysongs archive >> "%SetupLog%"
 %DocDrive%
 cd "%DocFolder%"
 "%StartInstall%\wget.exe" -t 0 -c http://mmk-mmk.yolasite.com/resources/Setup_Apps_Documentation/mysongs
 del /Q _MySongs.exe > nul
 ren mysongs _MySongs.exe > nul
 if exist .\_MySongs.exe goto extr2-mysongs
 echo Failed to download _My Songs archive file (wget-mysongs) - Exiting Install >> "%SetupLog%"
 echo DocDrive = %DocDrive% >> "%SetupLog%"
 echo DocFolder = %DocFolder% >> "%SetupLog%"
 cls 
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                Failed to download _My Songs archive file               **
 echo **                                                                        **
 echo **                                                                        **
 echo **                           Exiting Install                              **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 pause >nul
 Set Success=no
 goto end


:extr2-mysongs
 echo Extracting My Songs archive >> "%SetupLog%"
 cls
 echo ****************************************************************************
 echo **            The next screen will pop up a Windows Application           **
 echo **                                                                        **
 echo **        It is VERY important that you move the window to the side       **
 echo **                                                                        **
 echo **       so you can read the instructions that will be displayed here     **
 echo **                                                                        **
 echo **  The window you are reading now will tell you what to click and type   **
 echo **                                                                        **
 echo **   In Many cases the success of the installation and setup of extra     **
 echo **   options are dependent on your following those directions             **
 echo **                                                                        **
 echo **                      EXACTLY as spelled out here                       **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **      Press any key when you are ready to comply with this request      **
 echo **                                                                        **
 echo ****************************************************************************
 pause >nul   
 cls
 echo ****************************************************************************
 echo **                                                                        **
 echo ** If You see any Security Warning Popups - allow the application to run  **
 echo **                                                                        **
 echo **       Click Install in the "Extracting _My Songs Folder" window        **
 echo **                                                                        **
 echo **        If you are prompted to replace a file Click Yes to All          **
 echo **                                                                        **
 echo **                                                                        **
 echo **                 Wait for the Extraction to complete                    **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **            The Extraction window will close automatically              **
 echo **                                                                        **
 echo ****************************************************************************

 _MySongs.exe


:chk-utils
 if exist "%DocFolder%\_My Songs\_Setup\Utils\wget.exe" goto del-mysongs
 echo Failed to Extract _My Songs archive file (chk-utils) >> "%SetupLog%"
 echo DocDrive = %DocDrive% >> "%SetupLog%"
 echo DocFolder = %DocFolder% >> "%SetupLog%"
 echo ****************************************************************************
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                Failed to Extract _My Songs archive file                **
 echo **                                                                        **
 echo **                                                                        **
 echo **                           Exiting Install                              **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **                       Press any key to continue                        **
 echo **                                                                        **
 echo ****************************************************************************
 Set Success=no
 goto end


:del-mysongs
 echo del-mysongs >> "%SetupLog%"
 del /Q .\_MySongs.exe
 if not exist .\_MySongs.exe goto Mid-Housekeeping
 echo Did not successfully clean up My Songs archive >> "%SetupLog%"
 goto Mid-Housekeeping


:Mid-Housekeeping
 echo Mid-Housekeeping >> "%SetupLog%"
 Set MySongs=%DocFolder%\_My Songs
 Set SetupFolder=%MySongs%\_Setup
 Set SetupUtils=%SetupFolder%\Utils
 Set SetupTemp=%SetupFolder%\Temp

 echo MySongs = %MySongs% >> "%SetupLog%"
 echo SetupFolder = %SetupFolder% >> "%SetupLog%"
 echo SetupUtils = %SetupUtils% >> "%SetupLog%"
 echo SetupTemp = %SetupTemp% >> "%SetupLog%"

 echo moving daw-setup.%CurrentStamp%.log to %SetupFolder%\daw-setup.%CurrentStamp%.log >> "%SetupLog%"
 if exist "%SetupFolder%\daw-setup.%CurrentStamp%.log" copy /Y "%SetupFolder%\daw-setup.%CurrentStamp%.log" "%SetupFolder%\daw-setup.%CurrentStamp%.log.backed up %date:/=-% %time::=%" > nul
 DEL /Q "%SetupFolder%\daw-setup.%CurrentStamp%.log" > nul 2> nul
 move /Y "%SetupLog%" "%SetupFolder%\daw-setup.%CurrentStamp%.log" >nul

 Set SetupLog=%SetupFolder%\daw-setup.%CurrentStamp%.log
 echo daw-setup.%CurrentStamp%.log moved to %SetupLog% >> "%SetupLog%"
 goto wget-vst


:wget-vst
 if exist "%MySongs%\_VST Plugins\RubyTube\help\assets\images\autogen\clearpixel.gif" goto global-vst
 set geturl=http://mmk-mmk.yolasite.com/resources/Setup_Apps_Documentation/vstplugins
 set rename-file=_vstplugins.exe
 set checkfile=_VST Plugins\RubyTube\help\assets\images\autogen\clearpixel.gif
 call "%SetupUtils%\s-get-archived.bat" mysongs unzip nosplash
 set geturl=
 set rename-file=
 set checkfile=
 if %CalledStatus%.==success. goto global-vst
 Set Success=no
 goto global-vst


:global-vst
REM Kristal and Audacity are not using VST Global Setting so not setting it
 goto asio4all
 rem call "%SetupUtils%\s-vstglobal.bat" nosplash
 call "%SetupUtils%\s-vstglobal.bat" splash
 REM Error Code Checking here
 goto asio4all


:asio4all
 call "%SetupUtils%\s-asio4all.bat" nosplash
 rem call "%SetupUtils%\s-asio4all.bat" splash
 REM Error Code Checking here
 goto kristal


:kristal
 call "%SetupUtils%\s-kristal.bat" filler nosplash
 rem showing three options available 
     rem call "%SetupUtils%\s-kristal.bat" filler nosplash novst
 rem v2 lets kristal run after installing (instead of removing checkmark) 
     rem call "%SetupUtils%\s-kristal-v2.bat" filler nosplash novst
 REM Error Code Checking here
 goto audacity


:audacity
 call "%SetupUtils%\s-audacity.bat"
 REM Error Code Checking here
 rem two statuses available
 rem	CalledStatusAudacity126
 rem	CalledStatusAudacity1314
 goto razor-install


:razor-install
 call "%SetupUtils%\s-razor.bat" filler nosplash
 rem call "%SetupUtils%\s-razor.bat" filler splash
 REM Error Code Checking here
 goto tb-strobe


:tb-strobe
 call "%SetupUtils%\s-tbstrobe.bat" nosplash
 rem call "%SetupUtils%\s-tbstrobe.bat" splash
 REM Error Code Checking here
 goto dpclat


:dpclat
REM Cannot be distributed without permission
 call "%SetupUtils%\s-dpclat.bat" nosplash
 rem call "%SetupUtils%\s-dpclat.bat" splash
 REM Error Code Checking here
goto latencymon


:latencymon
REM Only supported on Vista or higher
 call "%SetupUtils%\s-latencymon.bat" nosplash
 rem call "%SetupUtils%\s-latencymon.bat" splash
 REM Error Code Checking here
goto end


:display-user-entered
REM User entered not yet supported
 goto end
REM
 echo display-user-entered >> "%SetupLog%"
 cls
 echo ****************************************************************************
 echo **    You can specify an installation folder when you run the script.     **
 echo **                                                                        **
 echo **  Note1: Make sure daw-setup.bat and wget.exe files are on your Desktop!**
 echo **  Note2: The directory you specify must already exist!                  ** 
 echo **  Note3: If your Path has spaces in it that is ok                       **
 echo **                                                                        **
 echo **       Click Start - All Programs - Accessories - Command Prompt        **
 echo **                                                                        **
 echo **  In the Command Prompt window type the following line and press Enter  **
 echo **         cd desktop                                                     **
 echo **                                                                        **
 echo **  Next, type daw-setup.bat "path to install to" and press Enter         **
 echo **                                                                        **
 echo **  Examples...                                                           **
 echo **      daw-setup.bat C:\SomeStuff                                        **
 echo **      daw-setup.bat G:\My Documents\Another Folder\Music\Great Stuff    **
 echo **                                                                        **
 echo ****************************************************************************
 echo **                                                                        **
 echo **          Press any key to exit the Installer and start again           **
 echo **                                                                        **
 echo ****************************************************************************
 pause > nul
 goto end


:end
 rem If User exits before _My Songs is created then s-module-complete.bat does not exist.
 if not exist "%SetupUtils%\s-module-complete.bat" goto End-Housekeeping
 if %success%.==no. call "%SetupUtils%\s-module-complete.bat" Main with errors
 if %success%.==yes. call "%SetupUtils%\s-module-complete.bat" Main


:End-Housekeeping

REM Log directory structure
echo directory listing at end of install >> "%SetupLog%"

echo razorlame >> "%SetupLog%"
dir /s "%ProgFiles%\RazorLame115a" >> "%SetupLog%" 2> nul

echo my songs >> "%SetupLog%"
dir /s "%MySongs%" >> "%SetupLog%" 2> nul

echo kreatives >> "%SetupLog%"
dir /s "%ProgFiles%\Kreatives.org" >> "%SetupLog%" 2> nul

echo TB Strobe Tuner >> "%SetupLog%"
dir /s "%ProgFiles%\TB Strobe Tuner" >> "%SetupLog%" 2> nul

echo ASIO4All >> "%SetupLog%"
dir /s "%ProgFiles%\ASIO4ALL" >> "%SetupLog%" 2> nul

echo dpclat >> "%SetupLog%"
dir /s "%ProgFiles%\DPC Latency Checker" >> "%SetupLog%" 2> nul

echo Latency Monitor >> "%SetupLog%"
rem This is 64bit app on 64bit systems - check real program files folder also
dir /s "%ProgFiles%\LatencyMon" >> "%SetupLog%" 2> nul
dir /s "%ProgramFiles%\LatencyMon" >> "%SetupLog%" 2> nul

echo audacity >> "%SetupLog%"
dir /s "%ProgFiles%\Audacity" >> "%SetupLog%" 2> nul

echo audacity 1.3 (9x,ME) >> "%SetupLog%"
dir /s "%ProgFiles%\Audacity 1.3 Beta" >> "%SetupLog%" 2> nul

echo audacity 1.3 unicode (XP or higher) >> "%SetupLog%"
dir /s "%ProgFiles%\Audacity 1.3 Beta (Unicode)" >> "%SetupLog%" 2> nul


REM If %Success%==No goto next step
rem  echo copying daw-setup.bat to %SetupFolder% >> "%SetupLog%"
rem  copy /Y "%StartInstall%\daw-setup.bat" "%SetupFolder%\daw-setup.bat" > nul
REM else Success = Yes and cleanup original install files from desktop.
REM MOVE Desktop\daw-setup.bat %SetupFolder% > nul
REM DEL daw-setup.bat wget.exe from desktop > nul
REM DEl other temporary files (but not the final registry files) > nul
rem  del /Q "%StartInstall%\wget.exe" > nul
rem  del /Q "%StartInstall%\daw-setup.bat"  > nul -  call another program to do this.


rem if exist "%SetupUtils%\s-reboot-message.bat" call "%SetupUtils%\s-reboot-message.bat"


REM echo all variables used to daw-setup.log before cleaning them up
echo Variables being cleaned up are >> "%SetupLog%"
echo DocFolder = %DocFolder% >> "%SetupLog%"
echo SetupLog = %SetupLog% >> "%SetupLog%"
echo StartInstall = %StartInstall% >> "%SetupLog%"
echo SetupFolder = %SetupFolder% >> "%SetupLog%"
echo SetupUtils = %SetupUtils% >> "%SetupLog%"
echo SetupTemp = %SetupTemp% >> "%SetupLog%"
echo MySongs = %MySongs% >> "%SetupLog%"
echo vst-path = %vst-path% >> "%SetupLog%"
echo CurrentStamp = %CurrentStamp% >> "%SetupLog%"
echo DocDrive= %DocDrive% >> "%SetupLog%"

rem do not clean up SetupLog variable until last line of script.

REM Not adding more for now.  
REM When the shell closes they will cleanup themselves.

set DocFolder=
Set StartInstall=
Set SetupFolder=
Set SetupUtils=
Set SetupTemp=
Set MySongs=
Set vst-path=
Set Success=
set CurrentStamp=
set DocDrive=


echo . >> "%SetupLog%"
echo ------------------------------------------------ >> "%SetupLog%"
echo End Install %date% %time% >> "%SetupLog%" 
echo ------------------------------------------------ >> "%SetupLog%"
echo . >> "%SetupLog%"

set SetupLog=
rem figure out how to do this best - call another job or something
rem        del /Q "%StartInstall%\startup.bat"
