diff --git a/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat new file mode 100755 index 0000000000000000000000000000000000000000..066b0a23b3556713734ebae3f6d559555fed69e3 --- /dev/null +++ b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.bat @@ -0,0 +1,35 @@ +@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 %* diff --git a/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs new file mode 100644 index 0000000000000000000000000000000000000000..7d7f62d7fbf9927f9f916eaff0f4c76aad79c8b6 --- /dev/null +++ b/Code/Mantid/Build/CMake/Packaging/launch_mantidplot.vbs @@ -0,0 +1,37 @@ +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +' 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