如何在启动时添加加载库、更改目录等? [英] How to add load libraries, change directory, etc. on startup?

查看:63
本文介绍了如何在启动时添加加载库、更改目录等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在启动 Dymola 时自动加载库、切换到某个工作目录等?

Is there a way to automatically load libraries, change to a certain working directory, etc. when launching Dymola?

推荐答案

此方法已针对 Dymola 2017FD01 进行了测试.以前的版本通过不再可用的 setup.mos 脚本使用不同的方法.截至本文发布时,无法通过 Dymola GUI 执行此操作.

This method has been tested for Dymola 2017FD01. Prior versions used a different method via a setup.mos script that is no longer available. As of this posting, there is no option to perform this actions via the Dymola GUI.

它可以通过 .mos 文件轻松完成,步骤如下所示:

It can be easily accomplished via a .mos file with the steps shown below:

  1. 在有意义的位置创建一个 .mos 文件.例如,C:\Users\USERNAME\Documents\Dymola\startup.mos
  2. 将所需的操作添加到 .mos 文件中.例如,要加载库,请添加 openModel("C:\\Users\\USERNAME\\Documents\\ModelicaLibrary\\package.mo");
  3. Dymola 始终将其自动生成的文件放在当前工作目录中.将该位置设为相同位置通常是个好主意,这样就无需查找输出文件的位置.因此,在 .mos 文件的末尾更改当前目录:cd("C:\\Users\\USERNAME\\Documents\\Dymola");
  4. 如果 Dymola.exe 文件不存在快捷方式,则创建一个.
  5. 右键单击快捷方式并转到 Properties.在 Shortcut>Target 下,在末尾添加 "C:\Users\USERNAME\Documents\Dymola\startup.mos".该单元格的内容现在应如下所示:"C:\Program Files (x86)\Dymola 2017 FD01\bin64\Dymola.exe" "C:\Users\vmg\Documents\Dymola\startup.mos"
  6. 就是这样.从该快捷方式启动 Dymola 时,应执行 .mos 文件中指定的操作.
  1. Create a .mos file in a location that makes sense. For example, C:\Users\USERNAME\Documents\Dymola\startup.mos
  2. Add the actions desired to .mos file. For example, to load a library add openModel("C:\\Users\\USERNAME\\Documents\\ModelicaLibrary\\package.mo");
  3. Dymola always puts its auto-generated files in the current working directory. It's often a good idea to have that location be the same location so there is no need to hunt down the location of output files. Therefore, at the end of the .mos file change the current directory: cd("C:\\Users\\USERNAME\\Documents\\Dymola");
  4. If no shortcut exists to the Dymola.exe file, then create one.
  5. Right click the shortcut and go to Properties. Under Shortcut>Target append "C:\Users\USERNAME\Documents\Dymola\startup.mos"at the end. The contents of that cell should now look something like this: "C:\Program Files (x86)\Dymola 2017 FD01\bin64\Dymola.exe" "C:\Users\vmg\Documents\Dymola\startup.mos"
  6. That's it. When Dymola is launched from that shortcut the actions specified in the .mos file should be carried out.

这篇关于如何在启动时添加加载库、更改目录等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆