@ECHO OFF && SETLOCAL
::
:: Install script for P4GT plug-ins. Does not require installer.
::
:: Checks for default install paths for listed products and installs
:: P4GT plug-ins in appropriate folders:
:: 3ds max 2014 (x64 only)
:: Maya 2014 (x64 only)
:: Softimage 2014 (x64 only)
:: Photoshop CC (x86 / x64 supported)
::
:: Configurable variables
::
SET Install_Photoshop-CC_x86=yes
SET Install_Photoshop-CC_x64=yes
SET Install_3dsMax-2014_x64=yes
SET Install_Maya-2014_x64=yes
SET Install_Softimage-2014_x64=yes
::
:: Configurable [default] install locations for P4GT plug-ins
::
SET __Photoshop-CC_X86_TargetDir="C:\Program Files (x86)\Adobe\Adobe Photoshop CC\Plug-ins\Automate"
SET __Photoshop-CC_X64_TargetDir="C:\Program Files\Adobe\Adobe Photoshop CC (64 Bit)\Plug-ins\Automate"
SET __3dsMax-2014_X64_TargetDir="C:\Program Files\Autodesk\3ds Max 2014\plugins"
SET __Maya-2014_X64_TargetDir="C:\Program Files\Autodesk\Maya2014"
SET __Softimage-2014_X64_TargetDir="C:\Program Files\Autodesk\Softimage 2014\Application\Plugins"
SET __Perforce_Primary_TargetDir="C:\Program Files (x86)\Perforce"
SET __Perforce_Secondary_TargetDir="C:\Program Files\Perforce"
::
:: Non-configurable state variables
::
SET Target_Installed=false
SET Install_Success=true
::
:: Initialize log file
::
ECHO P4GT Installation >> p4gt_install.log
date /T >> p4gt_install.log
time /T >> p4gt_install.log
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:PHOTOSHOP-CC_X86
IF %Install_Photoshop-CC_X86% NEQ yes GOTO :END_PHOTOSHOP-CC_x86
REM ===================Checking if product Adobe Photoshop CC (x86) is installed==========================
SET Target=P4GT-Photoshop.8li
SET TargetDir=%__Photoshop-CC_X86_TargetDir%
IF NOT EXIST %TargetDir% GOTO :END_PHOTOSHOP-CC
REM ===================Installing plug-in for Adobe Photoshop CC (x86)==========================
SET Function=copy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target_Installed=true
ECHO "P4GT plug-in installed for Photoshop CC (x86)"
:END_PHOTOSHOP-CC_x86
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:PHOTOSHOP-CC_X64
IF %Install_Photoshop-CC_x64% NEQ yes GOTO :END_PHOTOSHOP-CC_x64
REM ===================Checking if product Adobe Photoshop CC (x64) is installed==========================
SET Target=P4GT-Photoshop.8li
SET TargetDir=%__Photoshop-CC_X64_TargetDir%
IF NOT EXIST %TargetDir% GOTO :END_PHOTOSHOP-CC_X64
REM ===================Installing plug-in for Adobe Photoshop CC (x64)==========================
SET Function=copy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target_Installed=true
ECHO "P4GT plug-in installed for Photoshop CC (x64)"
:END_PHOTOSHOP-CC_x64
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:3DSMAX-2014_X64
IF %Install_3dsMax-2014_x64% NEQ yes GOTO :END_3DSMAX-2014_X64
REM ===================Checking if product Autodesk 3ds Max 2014 (x64) is installed==========================
SET Target=P4GT-3dsMax.gup
SET TargetDir=%__3dsMax-2014_X64_TargetDir%
IF NOT EXIST %TargetDir% GOTO :END_3DSMAX-2014_X64
REM ===================Installing plug-in for Autodesk 3ds Max 2014 (x64)==========================
SET Function=copy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target_Installed=true
ECHO "P4GT plug-in installed for 3ds Max 2014 (x64)"
:END_3DSMAX-2014_X64
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:MAYA-2014_X64
IF %Install_Maya-2014_x64% NEQ yes GOTO :END_MAYA-2014_X64
REM ===================Checking if product Autodesk Maya 2014 (x64) is installed==========================
SET Target=P4GT-Maya.mll
SET TargetDir=%__Maya-2014_X64_TargetDir%\bin\plug-ins
IF NOT EXIST %TargetDir% GOTO :END_MAYA-2014_X64
REM ===================Installing plug-in for Autodesk Maya 2014 (x64)==========================
SET Function=copy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
REM ===================Installing plug-in scripts for Autodesk Maya 2014 (x64)==========================
SET Target=perforceCreateUI.mel
SET TargetDir=%__Maya-2014_X64_TargetDir%\scripts\others
SET Function=copy
SET Direction=into
IF NOT EXIST %TargetDir% GOTO :END_MAYA-2014_X64
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target=perforceDeleteUI.mel
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target_Installed=true
ECHO "P4GT plug-in installed for Maya 2014 (x64)"
:END_MAYA-2014_X64
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:SOFTIMAGE-2014_X64
IF %Install_Softimage-2014_x64% NEQ yes GOTO :END_SOFTIMAGE-2014_X64
REM ===================Checking if product Autodesk Softimage 2014 (x64) is installed==========================
SET Target=P4GT-Softimage.dll
SET TargetDir=%__Softimage-2014_X64_TargetDir%
IF NOT EXIST %TargetDir% GOTO :END_SOFTIMAGE-2014_X64
REM ===================Installing plug-in for Autodesk Softimage 2014 (x64)==========================
SET Function=copy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target_Installed=true
ECHO "P4GT plug-in installed for Softimage 2014 (x64)"
:END_SOFTIMAGE-2014_X64
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:INSTALL_FINISH
IF %Target_Installed% NEQ true GOTO :NOTHING_INSTALLED
REM ===================Copy Release Notes, Help, and README files==========================
SET TargetDir=%__Perforce_Primary_TargetDir%
IF NOT EXIST %TargetDir% SET TargetDir=%__Perforce_Secondary_TargetDir%
IF NOT EXIST %TargetDir% MKDIR %TargetDir% >>p4gt_install.log 2>>&1
SET Target=p4gtnotes.txt
SET Function=xcopy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
SET Target=p4gt.chm
SET Function=xcopy
SET Direction=into
xcopy.exe /R /Y %Target% %TargetDir% >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
ECHO "P4GT Release notes and Help files installed"
REM ===================Register Help file==========================
SET Function=register
SET Direction=in
SET TargetDir=HKEY_LOCAL_MACHINE\Software\Perforce\P4GT
reg add "HKEY_LOCAL_MACHINE\Software\Perforce\P4GT" /V "HelpFilePath" /D %__Perforce_TargetDir%\p4gt.chm /F >>p4gt_install.log 2>>&1
IF %ERRORLEVEL% NEQ 0 GOTO :INSTALL_FAILED
reg add "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Perforce\P4GT" /V "HelpFilePath" /D %__Perforce_TargetDir%\p4gt.chm /F >>p4gt_install.log 2>>&1
ECHO "P4GT Help file has been registered"
GOTO :END
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:PLUGIN_INSTALLED
ECHO "P4GT plug-in installed for %Product%"
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:INSTALL_FAILED
SET Install_Success=false
ECHO "Failed to %Function% %Target% %Direction% %TargetDir%" >> p4gt_install.log
GOTO :END
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:NOTHING_INSTALLED
SET Install_Success=false
ECHO "No P4GT plug-ins need to be installed."
GOTO :END
::+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:END
IF %Install_Success% EQU true (ECHO "Installation Successful") ELSE (ECHO "Installation experienced problem, see p4gt_install.log")