-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
setup_express_launcher.bat
158 lines (143 loc) · 4.61 KB
/
setup_express_launcher.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
@echo off
@title = Command-line Package Installer
setlocal enabledelayedexpansion
set "launch_args=%1"
set "preferred_version=%2"
set "path_bat_script=%~dp0"
set "path_package_init=!path_bat_script!\setup_drag_drop_maya.py"
set "path_autodesk=C:\Program Files\Autodesk"
set "path_mayapy_end=\bin\mayapy.exe"
set "installation_status="
:ARGS
if "%1"=="" (
goto MENU
) else (
set "launch_args=%*"
goto LAUNCH
)
:MENU
@echo off
cls
color 0A
@echo on
@echo.
@echo.
@echo ÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛ ÛÛÛÛÛÛÛ
@echo ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
@echo ÛÛ ÛÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛÛ
@echo ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
@echo ÛÛÛÛÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ
@echo.
@echo.
@echo ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛ
@echo ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
@echo ÛÛÛÛÛÛÛ ÛÛÛÛÛ ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛ
@echo ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
@echo ÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛ ÛÛÛÛÛÛ ÛÛ
@echo.
@echo.
@echo.
@echo. 1 = Initialize GUI Installer
@echo. 2 = Perform Express Install
@echo. 3 = Perform Express Uninstall
@echo. 4 = Launch Without Installing
@echo. 5 = About / Help
@echo.
@echo.
@echo off
SET /P M=Type 1, 2, 3, 4 or 5 then press ENTER:
IF %M%==1 GOTO SET_ARGS_GUI
IF %M%==2 GOTO SET_ARGS_INSTALL
IF %M%==3 GOTO SET_ARGS_UNINSTALL
IF %M%==4 GOTO SET_ARGS_LAUNCH
IF %M%==5 GOTO ABOUT
GOTO EOF
:SET_ARGS_GUI
set "launch_args=-install -gui"
GOTO LAUNCH
:SET_ARGS_INSTALL
set "launch_args=-install -clean"
GOTO LAUNCH
:SET_ARGS_UNINSTALL
set "launch_args=-uninstall"
GOTO LAUNCH
:SET_ARGS_LAUNCH
set "launch_args=-launch"
GOTO LAUNCH
:LAUNCH
echo %preferred_version%| findstr /R "^-[0-9][0-9][0-9][0-9]$" > nul
if errorlevel 1 (
goto GET_LATEST_MAYAPY
) else (
goto GET_PREFERRED_MAYAPY
)
:GET_PREFERRED_MAYAPY
set "preferred_version_no_dash="
for /f "tokens=*" %%a in ('echo !preferred_version!') do (
set "line=%%a"
set "line=!line:-=!"
set "preferred_version_no_dash=!preferred_version_no_dash!!line!"
)
if exist "%path_autodesk%\Maya%preferred_version_no_dash%%path_mayapy_end%" (
set "path_mayapy=%path_autodesk%\Maya%preferred_version_no_dash%%path_mayapy_end%"
GOTO CHECK_MAYAPY_EXISTENCE
) else (
echo "Unable to find preferred version: %preferred_version_no_dash%. Looking for other versions..."
timeout /t 2 /nobreak
GOTO GET_LATEST_MAYAPY
)
:GET_LATEST_MAYAPY
set "latest_folder="
for /d %%G in ("%path_autodesk%\*") do (
set "folder_name=%%~nG"
if "!folder_name!" equ "" set "folder_name=%%~xG"
echo !folder_name! | findstr /r "^Maya[0-9][0-9][0-9][0-9]" > nul && set "latest_folder=%%G"
)
set "path_mayapy=%latest_folder%%path_mayapy_end%"
:CHECK_MAYAPY_EXISTENCE
if not exist "%path_mayapy%" (
set "installation_status=Unable to detect Maya installation"
GOTO TIMED_EXIT
) else (
"%path_mayapy%" %path_package_init% %launch_args%
)
endlocal
GOTO TIMED_EXIT
:ABOUT
@echo off
color 02
cls
endlocal
@echo on
@echo.
@echo. _
@echo. ( ) GT-Tools Package Setup
@echo. H
@echo. H This batch file attempts to install the package without
@echo. _H_ opening Maya or using the drag and drop python script.
@echo. .-'-.-'-.
@echo. / \ The installation process copies the necessary files to
@echo. ! ! the maya settings folder. Usually: "Documents\maya\gt-tools".
@echo. ! .-------'._
@echo. ! / / '.' '. \ The installation will also add an initialization line to every
@echo. ! \ \ @ @ / / "userSetup.mel" file found the maya the preference folder.
@echo. ! '---------' (This process will not affect existing lines)
@echo. ! _______!
@echo. ! .'-+-+-+! Options:
@echo. ! '.-+-+-+! 1. Initialize GUI Installer: Open full installer GUI (Same as in Maya)
@echo. ! """""" ! 2. Perform Express Install: Install package through the command-line
@echo. '-._______.-' 3. Perform Express Uninstall: Uninstall through the command-line
@echo. 4. Launch Without Installing: Run package from current location
@echo.
@echo.
@echo.
@echo off
pause
setlocal enabledelayedexpansion
GOTO MENU
:PAUSE
pause
:TIMED_EXIT
timeout /t 3 /nobreak
:EOF
EXIT