问题
Is it possible to call a script in Digital Micrograph from the Windows command line? I cannot seem to find information on command line options, if any are available, for DM.
回答1:
No, this is not possible for GMS version 2 or lower. There are no command-line parameters for script-launch in DigitalMicrograph.
However, if you want to run a script automatically on start-up of DM, you can do this by installing a script as plugin (.gtk file).
回答2:
From GMS 3.0.1 onward, there is an optional start-up parameter for the application.
You can type (in the command prompt):
DigitalMicrograph.exe /ef "test.s"
to launch the script
test.s
within the application.
Similar, you can type things like
DigitalMicrograph.exe /es "scriptcommand"
to directly execute the script-line
scriptcommand
within the application.
Unfortunately, earlier version of GMS do not have this option.
Note: When you call DigitalMicrograph.exe while the application is already running, it will not start the program again but instead activate the already running application. Therefore this can be used to launch a script in an already running application.
This also opens a nice way to run DM-scripts from a different editor like NotePad++.
In NotePad++ you can configure a "run" command. If you press F5 you specify a command to be called. So to have this run a DM script, use a line like the following:
"C:\Program Files\Gatan\DigitalMicrograph.exe" /ef "$(FULL_CURRENT_PATH)"
You can then execute a script writtin within NotePad++ simply by selecting this run.
来源:https://stackoverflow.com/questions/28495288/call-script-from-windows-command-line