-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.bat
185 lines (139 loc) · 6.45 KB
/
install.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@echo off
echo.
set copycmd=xcopy /q
rem ----------------------------------------------------------------------
rem Register the DLL in its current location
rem ----------------------------------------------------------------------
set dllFile=%~dp0\bin\WorkflowManagerAdministrationUtilities.dll
if not exist "%dllFile%" goto DLLNOTFOUND
rem --- Can't use a nice if-else here because of the parentheses in "Program Files (x86)"
if "%PROCESSOR_ARCHITECTURE%"=="x86" set esriRegAsm=%CommonProgramFiles%\ArcGIS\bin\esriRegAsm.exe & goto :EndSetEsriRegAsm
set esriRegAsm=%CommonProgramFiles(x86)%\ArcGIS\bin\esriRegAsm.exe
:EndSetEsriRegAsm
if not exist "%esriRegAsm%" goto EXENOTFOUND
echo Registering DLL...
"%esriRegAsm%" "%dllFile%" /p:Desktop
if %ERRORLEVEL% neq 0 call :REGFAILED
rem ----------------------------------------------------------------------
rem Find the location of the Workflow Manager Installation; copy any
rem required Workflow Manager DLLs to the current install location
rem ----------------------------------------------------------------------
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set wmxInstallDirKeyPath=HKLM\SOFTWARE\ESRI\WMX\10.4
) else (
set wmxInstallDirKeyPath=HKLM\SOFTWARE\Wow6432Node\ESRI\WMX\10.4
)
for /F "tokens=2* delims= " %%A IN ('REG QUERY "%wmxInstallDirKeyPath%" /v InstallDir') do set wmxInstallDir=%%B
rem --- JTX Shared DLL
set dllFile=%wmxInstallDir%bin\ESRI.ArcGIS.JTXUI.JTXShared.dll
if not exist "%dllFile%" goto DLLNOTFOUND
echo Copying shared DLL(s) from Workflow Manager install directory...
%copycmd% "%dllFile%" "%~dp0\bin"
rem ----------------------------------------------------------------------
rem Copy the toolbox to the ArcGIS install location
rem ----------------------------------------------------------------------
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set arcgisInstallDirKeyPath=HKLM\SOFTWARE\ESRI\Desktop10.4
) else (
set arcgisInstallDirKeyPath=HKLM\SOFTWARE\Wow6432Node\ESRI\Desktop10.4
)
for /F "tokens=2* delims= " %%A IN ('REG QUERY "%arcgisInstallDirKeyPath%" /v InstallDir') do set arcgisInstallDir=%%B
set sysToolboxDir=%arcgisInstallDir%ArcToolbox\Toolboxes
if not exist "%sysToolboxDir%" goto SYSTBXNOTFOUND
set srcToolbox=%~dp0\ArcToolbox\Toolboxes\Workflow Manager Administration Tools.tbx
if not exist "%srcToolbox%" goto TBXNOTFOUND
echo Copying toolbox to system toolboxes folder...
%copycmd% "%srcToolbox%" "%sysToolboxDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
rem ----------------------------------------------------------------------
rem Copy any scripts to the ArcGIS install location
rem ----------------------------------------------------------------------
set sysScriptDir=%arcgisInstallDir%ArcToolbox\Scripts
if not exist "%sysScriptDir%" goto SYSSCRIPTNOTFOUND
echo Copying toolbox scripts to system toolboxes folder...
set srcScript=%~dp0\ArcToolbox\Scripts\CreateJobsBasedOnFC.py
if not exist "%srcScript%" goto SCRIPTNOTFOUND
%copycmd% "%srcScript%" "%sysScriptDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
set srcScript=%~dp0\ArcToolbox\Scripts\DeleteJobsMatchingCriteria.py
if not exist "%srcScript%" goto SCRIPTNOTFOUND
%copycmd% "%srcScript%" "%sysScriptDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
set srcScript=%~dp0\ArcToolbox\Scripts\SendNotificationForJobsInQuery.py
if not exist "%srcScript%" goto SCRIPTNOTFOUND
%copycmd% "%srcScript%" "%sysScriptDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
set srcScript=%~dp0\ArcToolbox\Scripts\UploadAllTaskAssistantWorkbooks.py
if not exist "%srcScript%" goto SCRIPTNOTFOUND
%copycmd% "%srcScript%" "%sysScriptDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
rem ----------------------------------------------------------------------
rem Copy any documentation (XML metadata) files to the ArcGIS install
rem location
rem ----------------------------------------------------------------------
echo Copying help files to the system help folder...
set helpFileDir=%arcgisInstallDir%help\gp
if not exist "%helpFileDir%" goto HELPDIRNOTFOUND
set srcHelpFileDir=%~dp0\help\gp
if not exist "%srcHelpFileDir%" goto HELPFILESNOTFOUND
%copycmd% "%srcHelpFileDir%\*_WMXAdminUtils.xml" "%helpFileDir%"
if %ERRORLEVEL% neq 0 goto COPYFAILED
rem ----------------------------------------------------------------------
rem Let the user know that they need to unzip one other GDB manually
rem ----------------------------------------------------------------------
echo.
echo **********************************************************************
echo * NOTE: If you intend to use the example scripts provided in the
echo * "Documentation" directory, please be sure to unzip the
echo * "SampleData.gdb" file geodatabase located in that directory.
echo **********************************************************************
goto END
rem ----------------------------------------------------------------------
rem Misc. error messages & subroutines
rem ----------------------------------------------------------------------
:DLLNOTFOUND
echo ERROR: Could not find the DLL: %dllFile%
goto END
:EXENOTFOUND
echo ERROR: Could not find esriRegAsm where expected: %esriRegAsm%
goto END
:REGFAILED
echo ERROR: Failed to register the DLL; try registering the DLL manually?
echo Are you an administrator on this machine?
echo Did you select "Run as administrator" to run this .bat file?
echo Did you "Unblock" the downloaded .zip file before extracting it?
goto :EOF
:SYSTBXNOTFOUND
echo ERROR: Could not find the system toolbox location: %sysToolboxDir%
echo Do you have ArcGIS Desktop 10.4 installed on your system?
goto END
:SYSSCRIPTNOTFOUND
echo ERROR: Could not find the system toolbox script location: %sysScriptDir%
echo Do you have ArcGIS Desktop 10.4 installed on your system?
goto END
:TBXNOTFOUND
echo ERROR: Could not find the toolbox: %srcToolbox%
goto END
:SCRIPTNOTFOUND
echo ERROR: Could not find the toolbox script: %srcScript%
goto END
:COPYFAILED
echo ERROR: Could not copy item to the system toolbox/script location.
echo Are you an adminstrator on this machine?
echo Did you select "Run as administrator" to run this .bat file?
goto END
:HELPDIRNOTFOUND
echo ERROR: Could not find the GP tool help directory: %helpFileDir%
echo Do you have ArcGIS Desktop 10.4 installed on your system?
goto END
:HELPFILESNOTFOUND
echo ERROR: Could not find the help files: %srcHelpFileDir%
goto END
rem ----------------------------------------------------------------------
rem End the program
rem ----------------------------------------------------------------------
:END
echo.
pause
@echo on
@goto :EOF