#NoTrayIcon #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=e2.ico #AutoIt3Wrapper_Outfile=e2sfx.exe #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=More info at http://www.e2open.com/resource-center/resource/e2open-b2b-client/ #AutoIt3Wrapper_Res_Description=E2open B2BClient Installer #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=© 2000–2011 E2open, Inc #AutoIt3Wrapper_Res_Language=1033 #Autoit3Wrapper_Res_Compatibility=Win10 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: sprasad Script Function: Main B2BC install script. #ce ---------------------------------------------------------------------------- #include "err.au3" #include "sfx.au3" #include "progress.au3" Local $show = True, $deleteTmpDir = True Local $extraCmdLine = "" Local $extractOnly = False Local $showConfirm = True If $CmdLine[0] > 0 Then For $index = 1 To $CmdLine[0] Step 1 If $CmdLine[$index] == "-s" Then $show = False $showConfirm = False ElseIf $CmdLine[$index] == "-n" Then $deleteTmpDir = False ElseIf $CmdLine[$index] == "-x" Then $extractOnly = True $showConfirm = False $deleteTmpDir = False Else $extraCmdLine = $extraCmdLine & " " & $CmdLine[$index] EndIf Next EndIf If $showConfirm Then $retValue = MsgBox(36, "E2open Client Platform Installation", _ "Do you want to install the E2open B2BClient Platform ?") if $retValue == 7 Then Exit EndIf Local $test = False Local $workDir, $extractDir, $extractImage If $test Then $workDir = @ScriptDir & "\..\test" $extractDir = $workDir & "\out" $extractImage = $workDir & "\e2benc.exe" $deleteTmpDir = False Else $workDir = @TempDir & "\b2bci-" & @AutoItPID $extractDir = $workDir $extractImage = @AutoItExe EndIf Local $pbWindow = _ProgressBoxCreate("Extracting", $show) Local $startWorkDir = @WorkingDir DirCreate($workDir) DirCreate($extractDir) FileChangeDir($workDir) $progressCount = 100 $extractInfo = _ExtractorOpen($extractImage) If Not IsArray($extractInfo) Then _ShowError($extractInfo) Local $entryCount = _ExtractorGetEntryCount($extractInfo) For $index = 1 To $entryCount Step 1 $retValue = _ExtractEntry($extractInfo, $workDir) If $retValue <> "OK" Then _ShowError($retValue) _ProgressBoxSet($pbWindow, $index) Next _ExtractorClose($extractInfo) $progressCount -= $entryCount FileInstall("zlib1.dll", "zlib1.dll") Local $zipHandle, $index, $entryCount, $timer, $retValue $zipHandle = _ZipOpen("E2openB2BC_Windows.zip") If Not IsArray($zipHandle) Then _ShowError($zipHandle) $entryCount = _ZipGetEntryCount($zipHandle) $progressCount -= 1 _ProgressBoxSet($pbWindow, 100 - $progressCount) $timer = TimerInit() For $index = 1 To $entryCount Step 1 $retValue = _ZipExtract($extractDir, $zipHandle) If $retValue <> "OK" Then _ShowError($retValue) $retValue = _ProgressBoxSet($pbWindow, (($index / $entryCount) * $progressCount) _ + (100 - $progressCount)) If $retValue <> "OK" Then ExitLoop Next _ProgressBoxClose($pbWindow) If $test Then $timer = TimerDiff($timer) MsgBox(0, "Times", "Entries: " & $entryCount & ", Total Time: " & _ $timer & ", Rate: " & $timer/$entryCount) EndIf If $retValue == "OK" And $extractOnly == False Then Local $command = "install.bat" If $show == False Then $command = $command & " -s" ; Get the short form name of the file to avoid spaces and issues with the ; install batch file $initWorkDirName = FileGetShortName($startWorkDir) if @error <> 0 Then MsgBox(0, "Extraction Error", "Failed to get short name for directory '" & _ $startWorkDir & "'"); Exit EndIf $command = $command & " " & $extraCmdLine & " " & $initWorkDirName RunWait($command, "", @SW_HIDE) if @error <> 0 Then MsgBox(0, "Extraction Error", "Failed to execute command '" & $command & _ "' in " & @WorkingDir); EndIf EndIf _ZipClose($zipHandle) If $deleteTmpDir Then FileChangeDir(@TempDir) For $idx = 0 To 100 Step 1 If DirRemove($workDir, 1) == 0 Then Sleep(5000) Else ExitLoop EndIf Next Else MsgBox(0, "Extraction Directory", $workDir) EndIf Exit