@echo   off

Rem this attempts to copy the  Rapid Spanning Tree  files to their correct locations


set VIS_FOUND=false
set VIS_UN=false

if "%1" == "-u"   set VIS_UN=true
if "%1" == "-U"   set VIS_UN=true
if "%1" == "/u"   set VIS_UN=true
if "%1" == "/U"   set VIS_UN=true

if "%VIS_UN%" == "true"  shift

set VIS_DRIVE=c:

if "%1" == ""    goto find_first
if "%1" == "c:"  goto set_drive
if "%1" == "c:"  goto set_drive
if "%1" == "d:"  goto set_drive
if "%1" == "D:"  goto set_drive
if "%1" == "e:"  goto set_drive
if "%1" == "E:"  goto set_drive
if "%1" == "f:"  goto set_drive
if "%1" == "F:"  goto set_drive
if "%1" == "g:"  goto set_drive
if "%1" == "G:"  goto set_drive
if "%1" == "h:"  goto set_drive
if "%1" == "H:"  goto set_drive
if "%1" == "i:"  goto set_drive
if "%1" == "I:"  goto set_drive
if "%1" == "j:"  goto set_drive
if "%1" == "J:"  goto set_drive
if "%1" == "k:"  goto set_drive
if "%1" == "K:"  goto set_drive
if "%1" == "l:"  goto set_drive
if "%1" == "L:"  goto set_drive
if "%1" == "m:"  goto set_drive
if "%1" == "M:"  goto set_drive
if "%1" == "n:"  goto set_drive
if "%1" == "N:"  goto set_drive
goto usage

:set_drive
set VIS_DRIVE=%1

:find_first

echo .
echo .  Messages that start  "Could not find ...",  are normal and should be ignored
echo .

set VIS_PARSE=vis_2000


:find_next

rem pause

if "%VIS_PARSE%" == "vis_2000" set VIS_PATH=%VIS_DRIVE%\Program Files\visio
if "%VIS_PARSE%" == "vis_2000" set VIS_SOL_RST=%VIS_PATH%\solutions\Rapid Spanning Tree
if "%VIS_PARSE%" == "vis_2000" set VIS_STARTUP=%VIS_PATH%\StartUp
if "%VIS_PARSE%" == "vis_2000" set VIS_EXE="%VIS_PATH%\visio32.exe"


if "%VIS_PARSE%" == "vis_2002" set VIS_PATH=%VIS_DRIVE%\Program Files\Microsoft Office\Visio10
if "%VIS_PARSE%" == "vis_2002" set VIS_SOL_RST=%VIS_PATH%\1033\solutions\Rapid Spanning Tree
if "%VIS_PARSE%" == "vis_2002" set VIS_STARTUP=%VIS_PATH%\1033\StartUp
if "%VIS_PARSE%" == "vis_2002" set VIS_EXE="%VIS_PATH%\visio.exe"

if NOT EXIST "%VIS_EXE%" goto select_next_parse


set VIS_FOUND=true

if "%VIS_UN%" == "true"  goto uninstall


rem this is it ------------------------------------------
rem this is it ------------------------------------------
rem @echo   on

mkdir                           "%VIS_SOL_RST%

rem -- delete old versions of the style sheets and pdf  (there was a space in the orig pdf name)
del                             "%VIS_SOL_RST%\Rapid Spanning Tree  Rarely Used.vss"
del                             "%VIS_SOL_RST%\Rapid Spanning Tree  other.vss"
del                             "%VIS_SOL_RST%\Rapid Spanning Tree .pdf"

copy "Rapid Spanning Tree.vst"  "%VIS_SOL_RST%"
copy "Rapid Spanning Tree*.vss" "%VIS_SOL_RST%"
copy "Rapid Spanning Tree*.pdf" "%VIS_SOL_RST%"
copy "*.vsd"                    "%VIS_SOL_RST%"
copy "PermittedUse.txt"         "%VIS_SOL_RST%"

copy "Rapid Spanning Tree.vsl"  "%VIS_STARTUP%"
copy "RST_ContAssist.exe"       "%VIS_STARTUP%"
copy "RST_ContAssist.exe"       "%windir%"

@echo   off
rem this is it end ------------------------------------------
rem this is it end ------------------------------------------

goto select_next_parse


:uninstall

if NOT "%OS%" == "Windows_NT" set RPF_DELDIR=deltree /Y
if     "%OS%" == "Windows_NT" set RPF_DELDIR=rmdir   /S /Q

rem @echo   on

%RPF_DELDIR% "%VIS_SOL_RST%"
del          "%VIS_STARTUP%\Rapid Spanning Tree.vsl"
del          "%VIS_STARTUP%\RST_ContAssist.exe"
del          "%windir%\RST_ContAssist.exe"

@echo   off



:select_next_parse

rem pause

if "%VIS_PARSE%" == "vis_2002" goto done
if "%VIS_PARSE%" == "vis_2000" set VIS_PARSE=vis_2002
goto find_next

:done
if "%VIS_FOUND%" == "true" goto end

 

:not_found

@echo   off
echo .                                                                              
echo             This  install.bat  has not been able to find your visio                              
echo             installation - you may need to copy the files by hand                              
echo             Look at this batch file and use it as a guide.
echo .                                                                              
echo .                                                                              

:usage
@echo   off
echo usage -  install  [-U] [D:]"
echo                              -U    (optional) will do an uninstall"
echo                               D:   (optional) is the dive letter and :"
echo                                    of the drive visio is installed on"
echo                                    C: to N:  defaults to C:"
echo .                                                                              
echo                              if your visio is in a non standard place you"
echo                               will need to copy the files by hand"
echo .                                                                              
    
@echo   off

:end
