option explicit On Error Resume Next Dim oShell, objFSO, lnk, oExec, vAPPDATA Dim strLOverzija, strAllUsersStartup, strProgramFiles, strExtensionPath1, strExtensionPath2 Dim exitCode, strPathQuickstarter, strPathLnk, strLOPath Const regProfilesDir = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory" Const appDataDir = "AppData\Roaming" Set oShell = CreateObject( "WScript.Shell" ) Set objFSO = CreateObject("Scripting.FileSystemObject") exitCode = 0 Err.Number = 0 strLOverzija = WScript.Arguments.Item(0) 'pr. "LibreOffice 3.5" strAllUsersStartup = WScript.Arguments.Item(1) '$allusersstartup strProgramFiles = WScript.Arguments.Item(2) '$ProgramFiles86' strExtensionPath1 = WScript.Arguments.Item(3) 'pr. "\\domain\server\softwareDC\LibreOffice\extension.oxt" strExtensionPath2 = WScript.Arguments.Item(4) 'pr xy.oxt" ''' 'Delete folder ''' profilesDir = oShell.ExpandEnvironmentStrings(oShell.RegRead(regProfilesDir)) For Each user In objFSO.GetFolder(profilesDir).SubFolders If objFSO.FolderExists(objFSO.BuildPath(user.Path, appDataDir & "\LibreOffice\3\user\extensions")) Then objFSO.DeleteFolder(objFSO.BuildPath(user.Path, appDataDir & "\LibreOffice\3\user\extensions")) End If Next ''' 'Wscript.echo "setting quickstarter" ''' strPathQuickstarter = strProgramFiles & "\" & strLOverzija & "\program\quickstart.exe" If objFSO.FileExists(strPathQuickstarter) = true Then 'Wscript.echo "there is a location strPathQuickstarter: " & strPathQuickstarter strPathLnk = strAllUsersStartup & "\" & strLOverzija & ".lnk" 'Wscript.echo "there is " & strPathQuickstarter & ", creating link " & strPathLnk Set lnk = oShell.CreateShortcut(strPathLnk) lnk.TargetPath = strPathQuickstarter lnk.Description = strLOverzija lnk.WorkingDirectory = strProgramFiles & "\" & strLOverzija & "\program" lnk.Save If Err.Number <> 0 Then 'Wscript.echo "Error in creating shortcut in Startup " & Err.Description End If 'Clean up Set lnk = Nothing oShell.Exec strPathQuickstarter Else 'Wscript.echo "LO not installed" Wscript.Quit 2 End If '''install extension no1' Err.Number = 0 strLOPath = strProgramFiles & "\" & strLOverzija & "\program\unopkg.exe add --suppress-license --shared " & strExtensionPath1 'Wscript.echo strLOPath Set oExec = oShell.Exec(strLOPath) 'Wscript.echo oExec.Status 'Wscript.echo oExec.ProcessID 'Wscript.echo oExec.ExitCode If Err.Number <> 0 Then 'Wscript.echo Err.Description Wscript.Quit Err.Number End If '''install extension no2' Err.Number = 0 strLOPath = strProgramFiles & "\" & strLOverzija & "\program\unopkg.exe add --suppress-license --shared " & strExtensionPath2 'Wscript.echo strLOPath Set oExec = oShell.Exec(strLOPath) 'Wscript.echo oExec.Status 'Wscript.echo oExec.ProcessID 'Wscript.echo oExec.ExitCode If Err.Number <> 0 Then 'Wscript.echo Err.Description Wscript.Quit Err.Number End If Wscript.Quit 0