@echo off

call setenv.bat

mkdir %INSTALL_DIR%

set SHORTCUT1=%INSTALL_DIR%\create_cables.lnk
set TARGET1=%PROJECT_BIN%\getexdraw.bat
set ICON1=%PROJECT_DOC%\img\Icons\Icon_getex.ico

set SHORTCUT2=%INSTALL_DIR%\IOconverter.lnk
set TARGET2=%PROJECT_BIN%\ioconverter.bat
set ICON2=%PROJECT_DOC%\img\Icons\Icon_portal.ico

set SHORTCUT3=%INSTALL_DIR%\tr_dxf2txt.lnk
set TARGET_TRTXT=%PROJECT_BIN%\tr2txt.bat
set ICON3=%PROJECT_DOC%\img\Icons\dxf2txt.ico

set SHORTCUT_CS=%INSTALL_DIR%\tr_dxf2CS.lnk
set TARGET_CS=%PROJECT_BIN%\tr2dxf_cs.bat
set ICON_CS=%PROJECT_DOC%\img\Icons\dxfCS.ico

set SHORTCUT_EN=%INSTALL_DIR%\tr_dxf2EN.lnk
set TARGET_EN=%PROJECT_BIN%\tr2dxf_en.bat
set ICON_EN=%PROJECT_DOC%\img\Icons\dxfEN.ico

set SHORTCUT_FR=%INSTALL_DIR%\tr_dxf2FR.lnk
set TARGET_FR=%PROJECT_BIN%\tr2dxf_fr.bat
set ICON_FR=%PROJECT_DOC%\img\Icons\dxfFR.ico

set SHORTCUT_IT=%INSTALL_DIR%\tr_dxf2IT.lnk
set TARGET_IT=%PROJECT_BIN%\tr2dxf_it.bat
set ICON_IT=%PROJECT_DOC%\img\Icons\dxfIT.ico

set SHORTCUT_ES=%INSTALL_DIR%\tr_dxf2ES.lnk
set TARGET_ES=%PROJECT_BIN%\tr2dxf_es.bat
set ICON_ES=%PROJECT_DOC%\img\Icons\dxfES.ico

REM ersetze die Zeile mit setenv.bat durch die mit dem neuen Pfad
powershell -Command "(Get-Content getexdraw.bat)   -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content getexdraw.bat"
powershell -Command "(Get-Content ioconverter.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content ioconverter.bat"
powershell -Command "(Get-Content tr2txt.bat)      -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2txt.bat"

powershell -Command "(Get-Content tr2dxf_cs.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2dxf_cs.bat"
powershell -Command "(Get-Content tr2dxf_en.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2dxf_en.bat"
powershell -Command "(Get-Content tr2dxf_fr.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2dxf_fr.bat"
powershell -Command "(Get-Content tr2dxf_it.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2dxf_it.bat"
powershell -Command "(Get-Content tr2dxf_es.bat) -replace '^.*setenv.bat$', 'call %PROJECT_BIN%\setenv.bat' | Set-Content tr2dxf_es.bat"

REM Icon1 anlegen für getexdraw
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT1%');$s.TargetPath='%TARGET1%';$s.IconLocation='%ICON1%';$s.Save()"
REM Icon2 anlegen für Ioconverter
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT2%');$s.TargetPath='%TARGET2%';$s.IconLocation='%ICON2%';$s.Save()"

REM Icon für Txt Extraktion anlegen
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT3%');$s.TargetPath='%TARGET_TRTXT%';$s.IconLocation='%ICON3%';$s.Save()"

REM Icon für Übersetzungen anlegen
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT_CS%');$s.TargetPath='%TARGET_CS%';$s.IconLocation='%ICON_CS%';$s.Save()"
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT_EN%');$s.TargetPath='%TARGET_EN%';$s.IconLocation='%ICON_EN%';$s.Save()"
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT_FR%');$s.TargetPath='%TARGET_FR%';$s.IconLocation='%ICON_FR%';$s.Save()"
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT_IT%');$s.TargetPath='%TARGET_IT%';$s.IconLocation='%ICON_IT%';$s.Save()"
powershell -Command "$s=(New-Object -COM WScript.Shell).CreateShortcut('%SHORTCUT_ES%');$s.TargetPath='%TARGET_ES%';$s.IconLocation='%ICON_ES%';$s.Save()"

REM Öffne den Ordner damit man sieht ob es geklappt hat
explorer.exe %INSTALL_DIR%
