VbaFin.com

Visual Basic for Financial Professionals
Home      Murex
You can record tasks performed in Murex via its GUI much the same way you can record macros in Excel.
First you need to type something like this on the console: client_script.cmd /MXJ_SCRIPT_WRITE_TO:test.xml [Enter]
This should launch the GUI and whatever steps you take will be recorded in the test.xml file.
Then you can type something like this on the console: client_script.cmd /MXJ_SCRIPT_READ_FROM:test.xml [Enter]
This will execute everything recorded in the first step above.
Below is an example which creates a script file and then executes it with the Shell function. Click here for the full code.

Sub ExtractMurexPositions()

     Dim sPath As String, xmlFile As String, logFile As String, MXProgram As String
     xmlFile = "pos.xml" 'the script file
     logFile = "pos.log" 'contains a string indicating if the script was terminated normally or abnormally
     Const MUREX_SCRIPT_NAME = "client_script.cmd"
    
Const MUREX_MACRO_DIR = "C:\Program Files\Murex"
    
Const UPLOAD_DIR = "c:\tmp"
    
Const mxPassword = "0090006000f0005600470"
    
Const mxID = "MUREX"
    
Const DynamicTable = "POSITIONS"
    
Const UserGroup = "TOKYO"
     If CreateMXMLFile(MUREX_MACRO_DIR & xmlFile) Then ' click here to view the full code including this function
          sPath = CurDir
          ChDrive Left(MUREX_MACRO_DIR, 1)
          ChDir MUREX_MACRO_DIR
          MXProgram = MUREX_SCRIPT_NAME & " /MXJ_SCRIPT_READ_FROM:" & xmlFile & _
          " /MXJ_SCRIPT_LOG_FILE:" & UPLOAD_DIR & logFile
          Shell MXProgram, vbNormalFocus
          On Error Resume Next
          ChDrive Left(sPath, 1)
          ChDir sPath
     Else
          MsgBox "Could not create script file", vbExclamation, " Murex Script"
     End If

End Sub