Skip to content
Snippets Groups Projects
Commit 636a172a authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Add launch scripts for MantidPlot.

The .bat file is responsible for setting environment variables and
ultimately starting MantidPlot. The .vbs script ensures that when
starting from a desktop icon you ony see the MantidPlot window and not
the extra command window.
Refs #13337
parent 1be35a12
Branches 25537_add_runs_default_save_updates_mirrors_main_save
No related tags found
No related merge requests found
@echo off
setlocal enableextensions
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Launch script for MantidPlot
::
:: Sets the required environment variables for MantidPlot to run correctly.
:: All variables that are passed to this script are passed directly to
:: MantidPlot.exe
::
:: It is not advised to start MantidPlot.exe directly as this is unlikely
:: to work.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Set base paths
set _BIN_DIR=%~dp0
:: Strip the trailing slash so that the ~dp expansion works as expected
set _BIN_DIR=%_BIN_DIR:~,-1%
for /f "delims=" %%I in ("%_BIN_DIR%") do (
set _INSTALL_DIR=%%~dpI
)
set _INSTALL_DIR=%_INSTALL_DIR:~,-1%
set _EXTRA_PATH_DIRS=%_INSTALL_DIR%\bin;%_INSTALL_DIR%\PVPlugins;%_INSTALL_DIR%\plugins
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Required environment variables for Mantid
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set MANTIDPATH=%_BIN_DIR%
set PATH=%_EXTRA_PATH_DIRS%;%PATH%
set PV_PLUGIN_PATH=%_INSTALL_DIR%\PVPlugins\PVPlugins
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Start MantidPlot
:: The working directory is whatever is set by the caller
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
start "MantidPlot" /B /WAIT %_BIN_DIR%\MantidPlot.exe %*
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Launch script for launch_mantidplot.bat
'
' This is primarily used when launching via an icon. It ensures that the main
' launch_mantiplot.bat script is started with a hidden cmd window and only the
' MantidPlot application is visible.
'
' When launched via a shell all output from this is captured and discarded.
' For that reason most work is done in the main .bat file that can be used
' to get output and check error codes.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set WshShell = CreateObject("WScript.Shell")
' Location of this script
Set fso = CreateObject("Scripting.FileSystemObject")
binDir = fso.GetParentFolderName(WScript.ScriptFullName)
' Arguments - build a string. A straight join on Arguments is not possible
Set scriptArgs = WScript.Arguments
If scriptArgs.Count > 0 Then
ReDim argsArray(scriptArgs.Count-1)
For i = 0 To scriptArgs.Count-1
argsArray(i) = scriptArgs(i)
Next
argStr = Join(argsArray)
Else
argStr = ""
End If
' Assume that the launch bat file is alongside this one.
cmd = binDir & "\launch_mantidplot.bat" & chr(32) & argStr
WshShell.Run cmd, 0, false
' Cleanup
Set fso = Nothing
Set scriptArgs = Nothing
Set WshShell = Nothing
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment