I have a PC that is used for testing purposes and therefore constantly changes. For this I would like to load different FTP settings with a batch file (I use the batch for a number of other things already - such as IP, name, domain ...).
The different setting are stored in the oxc files.
Any possibility to do that ?
Thanks
Juergen
You can create a batch file which exits Opus, copies new oxc files over, then restarts Opus.
Here is some VBScript which tells Opus to exit, waits for it to shut-down, lets you do whatever you want (see the TODO line), then restarts Opus:
[code]option explicit
Dim OpusHome
OpusHome = "%ProgramFiles%\GPSoftware\Directory Opus"
' ****************************************************************************
' *** Process Utils **********************************************************
' ****************************************************************************
Private Function ProcessIsRunning( wmi, strProcess )
Dim colProcessList
Set colProcessList = wmi.Execquery("Select * from Win32_Process Where Name ='" & strProcess & "'")
If colProcessList.Count > 0 Then
ProcessIsRunning = True
Else
ProcessIsRunning = False
End If
Set colProcessList = Nothing
End Function
Private Function WaitForProcess( wmi, strProcess )
Dim i
WaitForProcess = False
For i = 0 to 100
If ProcessIsRunning( wmi, strProcess ) Then
WScript.Sleep 200
Else
WaitForProcess = True
Exit For
End If
Next
End Function
' ****************************************************************************
' *** MAIN *******************************************************************
' ****************************************************************************
Dim Args
Set Args = WScript.Arguments
Dim Shell
Set Shell = CreateObject("WScript.Shell")
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
Dim wmi
Set wmi = Getobject("Winmgmts:")
' Shut down dopus.exe if it is running.
If ProcessIsRunning(wmi, "dopus.exe") Then
Shell.Run """" & OpusHome & "\dopusrt.exe"" /CMD Close PROGRAM"
End If
' Wait for dopus.exe to finish shutting down.
Dim AllStopped
AllStopped = False
If WaitForProcess(wmi, "dopus.exe") Then
AllStopped = True
End If
If Not AllStopped Then
MsgBox WScript.ScriptName & ": Not performing update because Opus is still running"
WScript.Quit 1
End If
' TODO: Add whatever steps you need to do while Opus isn't running.
MsgBox WScript.ScriptName & ": Opus has exited. Click OK to restart it."
' You can copy some files like this:
' fs.CopyFile "SourceFilePath1", "DestFilePath1"
' fs.CopyFile "SourceFilePath2", "DestFilePath2"
' fs.CopyFile "SourceFilePath3", "DestFilePath3"
' Re-start dopus.exe
Shell.Run """" & OpusHome & "\dopus.exe"""
WScript.Quit 0[/code]
I did not know that simply copying was enough. Seaching showed where the oxc files were located.
That answerd the question, thanks
Juergen
BTW, you may not need to restart Opus. Some config file changes take effect as soon as they are copied over. I've not tested whether or not a restart of Opus is required for the FTP site config files.