Initialized

This commit is contained in:
Eugen Höglinger 2021-05-31 10:39:21 +02:00
commit 4aa4240950

101
re-registerNXExcelAddin.cmd Normal file
View File

@ -0,0 +1,101 @@
@echo off
:: 2021-05-31 - Dominik Prinz
:: re-registers the NX Excel Add-In by deleting a few registry keys and then running the register batch files in the NX Install directory
set title=Re-Register NX Excel Add-In
set logfile=%temp%\reregisterNXExcelAddIn.log
title %title%
:: checks for adminrights
net session > NUL 2>&1
if %errorlevel% == 0 goto checkforNX
title %title% - ERROR, NO ADMIN
echo.
echo.
echo Adminrights are required to run this script!
echo Please run it as Administrator.
echo.
echo.
pause
goto end
:: checks if NX is running
:checkforNX
tasklist |find /i "ugraf.exe" >nul
if not %errorlevel%==0 goto start
title %title% - ERROR, NX RUNNING
echo.
echo.
echo NX is still running!
echo Please exit out of NX and then run this script again.
echo.
echo.
pause
goto end
:: re-registers the NX Excel Add-In
:start
echo.
echo.
title %title% - Cleaning up the registry...
echo Cleaning up the registry...
echo ---------------------------------------
call :reg-cleanup
>nul timeout /t 1 /nobreak
echo.
echo.
title %title% - Unregistering the Excel Add-In...
echo Unregistering the Excel Add-In...
echo ---------------------------------------
call :unregister
>nul timeout /t 1 /nobreak
echo.
echo.
title %title% - Registering the Excel Add-In...
echo Registering the Excel Add-In...
echo ---------------------------------------
call :register
echo.
>nul timeout /t 1 /nobreak
echo.
echo.
echo.
title %title% - SUCCESS
echo SUCCESS!
echo The Excel Add-In has been re-registered, exporting to Excel should work now!
echo.
pause
goto end
:: subroutine that deletes some registry keys
:reg-cleanup
reg query HKCR\CLSID\{D99CD578-9510-4014-9161-F01778698159}\InprocServer32\1.2.0.0 >%logfile%
if %errorlevel%==0 reg delete HKCR\CLSID\{D99CD578-9510-4014-9161-F01778698159} /f >>%logfile%
reg query HKCR\WOW6432Node\CLSID\{D99CD578-9510-4014-9161-F01778698159}\InprocServer32\1.2.0.0 >>%logfile%
if %errorlevel%==0 reg delete HKCR\WOW6432Node\CLSID\{D99CD578-9510-4014-9161-F01778698159} /f >>%logfile%
reg query HKLM\SOFTWARE\Classes\CLSID\{D99CD578-9510-4014-9161-F01778698159}\InprocServer32\1.2.0.0 >>%logfile%
if %errorlevel%==0 reg delete HKLM\SOFTWARE\Classes\CLSID\{D99CD578-9510-4014-9161-F01778698159} /f >>%logfile%
reg query HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{D99CD578-9510-4014-9161-F01778698159}\InprocServer32\1.2.0.0 >>%logfile%
if %errorlevel%==0 reg delete HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{D99CD578-9510-4014-9161-F01778698159} /f >>%logfile%
goto :eof
:: subroutine that unregisters the NX Excel Add-In
:unregister
echo STARTING UNREGISTER BATCH FILE >>%logfile%
call %UGII_BASE_DIR%\INSTALL\unregister_splm_files.bat >>%logfile%
@echo off
goto :eof
:: subroutine that registers the NX Excel Add-In
:register
echo STARTING REGISTER BATCH FILE >>%logfile%
call %UGII_BASE_DIR%\INSTALL\register_splm_files.bat >>%logfile%
@echo off
goto :eof
:end