Skip to main content
1-Visitor
October 25, 2022
Solved

Javascript calculation in MAthcad

  • October 25, 2022
  • 2 replies
  • 1577 views

Hi,

 

I have created some scripts to change some inputs in Mathcad and read the Output fields but I am finding troubles as the file is not fully updated when I read the outputs. I am trying to calculate with Syncronize() but overwrite my inputs and I would like to save the file but I am not finding the way.

 

Thank you

Best answer by JV_10467934

Mathcad Prime 8.0.

 

I have found a partial solucion that is overwrite the file.

 

worksheet.SaveAs(fileSystemObject.BuildPath(dirScript,"file.mcdx"))

 

I have to check in deep if all the outputs are right but at least the outputs looks better.

2 replies

21-Topaz II
October 25, 2022

Hi,

 

The close statement is a function associated with the worksheet variable.

From the help file

 

How to create a worksheet variable

var worksheet = mathcad.Open(fileSystemObject.BuildPath(dirScript,"test.mcdx"));

 

Close(SaveOption)—Closes the worksheet if it is open in PTC Mathcad Prime.
SaveOption
SpSaveChanges—Force to save changes, without prompting the user, before the worksheet is closed.
spPromptToSaveChanges—Prompt the user to save changes before the worksheet is closed.
spDiscardChanges—Discard all changes and close the worksheet.
The special behavior for a new and non-modified worksheet:
The worksheet is closed without prompting the user, even if saveOptionArg is set to spPromptToSaveChanges.
The worksheet is closed without prompting the user, even if saveOptionArg is set to spSaveChanges.

24-Ruby III
October 26, 2022

Please specify which version of Mathcad you are using.

JV_104679341-VisitorAuthorAnswer
1-Visitor
October 31, 2022

Mathcad Prime 8.0.

 

I have found a partial solucion that is overwrite the file.

 

worksheet.SaveAs(fileSystemObject.BuildPath(dirScript,"file.mcdx"))

 

I have to check in deep if all the outputs are right but at least the outputs looks better.