Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Batch file for running multiple version of OpenModelica

Batch file for running multiple version of OpenModelica

Hi there,

I'm running different versions of OMEdit (1.9.7, 1.17.0, 1.18.0) and I've made a batch script to replace the "omedit.ini" file before launching OMEdit, so each version of the program has the correct ini file. In that batch script I also set the corresponding environmental variables.

This works well, but I doesn't allow me to launch two version of OMEdit at the same time.

Here is the batch file for OMEdit 1.8.0 (OMEdit1.18.0.bat):


@ECHO OFF

REM Set OpenModelica environmental variables:
set OPENMODELICAHOME=C:\OpenModelica1.18.0-64bit
set OPENMODELICALIBRARY=C:\OpenModelica1.18.0-64bit\lib\omlibrary

REM Name of OpenModelica init file:
SET INITFILE_NAME=omedit.ini

REM Folder where OpenModelica init file is located:
SET INITFILE_DIR=%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\openmodelica\

REM Folder of this batch script (need this to avoid problems when calling this batch file from a Shortcut file):
SET THIS_BATCHFILE_DIR=c:\Users\ferrucci\OneDrive\workspace\modelica\launch_openmodelica_multiple_versions\1.18.0\

REM -----------------------------------------------------
REM DO NOT TOUCH ANYTHING HEREAFTER !
REM -----------------------------------------------------

REM Remove existing init file:
DEL %INITFILE_DIR%%INITFILE_NAME%

REM Copy local init file to target folder (INITFILE_DIR):
COPY %THIS_BATCHFILE_DIR%%INITFILE_NAME% %INITFILE_DIR%

REM Open OpenModelica:
%OPENMODELICAHOME%\bin\OMEdit.exe
echo "OMEdit closed"

REM Backup init file (in case it was modified while using OpenModelica):
COPY %INITFILE_DIR%%INITFILE_NAME% .\%INITFILE_NAME%

REM Pause so the user needs to press any key:
PAUSE




Hope this helps to someone !!!

Re: Batch file for running multiple version of OpenModelica

I think you can also set %APPDATA% to a different directory for each of the versions so that you don't need to copy the omedit.ini.

There are 0 guests and 0 other users also viewing this topic
You are here: