I have 15 executable MathCad Prime 8 calculations that I’d like to run from a Windows Command batch file. How do I do this?
Solved! Go to Solution.
Hi,
Using the command line just opens the worksheet.
I suggest using the PTC Prime API as you can open, close, calculate, and exchange data into and out of Prime. See help for examples.
@LP_12590548 wrote:
I have 15 executable MathCad Prime 8 calculations that I’d like to run from a Windows Command batch file. How do I do this?
What does you mean by “executable” Mathcad Prime 8 calculations? For example, do you mean that you have 15 worksheets that you like to run from a batch file? Or do you mean something else’s?
Putting aside your question for a while, what is your particular reason for wanting to run Mathcad calculations from a Windows batch file? What does this do for you that running the calculations within Mathcad does not?
Stuart
If you wish to pursue the batch file route, you can create a batch file of the form.
"MathadPath\MathcadPrime.exe" "Worksheet Path\File 1.mcdx"
"MathadPath\MathcadPrime.exe" "Worksheet Path\File 2.mcdx"
...
"MathadPath\MathcadPrime.exe" "Worksheet Path\File 15.mcdx"
In my setup, MathadPath is C:\Program Files\PTC\Mathcad Prime 10.0.1.0.
I've tested the method using a couple of worksheets.
Stuart
Hi,
Using the command line just opens the worksheet.
I suggest using the PTC Prime API as you can open, close, calculate, and exchange data into and out of Prime. See help for examples.
@terryhendicott wrote:
Hi,
Using the command line just opens the worksheet.
I suggest using the PTC Prime API as you can open, close, calculate, and exchange data into and out of Prime. See help for examples.
True. I had forgotten that worksheets don't recalculate even if the Auto-Calculate option is selected.
It's a shame that the OP has Mathcad Prime 8 and not Mathcad Prime 10, otherwise the OP might have been able to write a Mathcad worksheet that used an Advanced Control to access the API to open and calculate a "batch" of other Mathcad worksheets.
Stuart
I opened the API Guide and the instructions said to open one of the DLL files with the corresponding tlb file using MS Visual Studio. I’m not sure how to do that but I opened Visual Studio Code and added my files to the workspace but I’m not sure what syntax I should use to create a script to open, calculate and close each of the 15 MathCad files.
Hi,
Syntax depends on what language you want to code in. Visual Basic or C are available in the Visual Studio Interface. Look at the example code in the Prime help files.
Cheers
Terry