3.3.2.52 Save

Syntax:

Save the current project, window or template to file.

save [option]
Note:

From Origin 2018 a new set of file formats are introduced and serve as the default formats. The new ones employ Unicode format so have better compatibility with non-English OS. Their file extensions add letter "u" at the end (stands for "Unicode") to distinguish with the old formats, e.g. ".opju" vs. ".opj" for project file format, ".ogwu" vs. ".ogw" for worksheet file format, ".oggu" vs. ".ogg" for graph file format, etc.

Most save command options (exclude those end up with letter "x") will save files to the new format. If you supply a filename with an old format extension in the command, it will be recognized as a wrong extension for the new format and Origin will append the right extension. For example, if you pass an old format extension like this:

save -DI %YMyProject.opj;

the file will be saved as MyProject.opj.opju in User Files folder (UFF). Origin will also append the correct extension if no extension is supplied. To save files in the old format to load them in Origin 2017 and earlier, you will need to

  • use a set of command options specified for the old formats, like -dij:
save -DIJ %YMyProject.opj;

See details in -dij, -ij, -ikj, -tj.

Or,

  • use the command options end up with letter "x". -dix, -ix and -tx will save a project or window to the format determined by the extension of the supplied file name in the command. For example,
save -DIX %yMyProject.opj;

will save the current project into UFF in name MyPorject.opj.

Options:

no option; Save the current project using the specified path and filename

Syntax: save message

Save the current project using the specified path and filename. You can specify the path and the file name after the command. For example:

save %Ymyfilename; //save the current project to UFF entitled "myfilename"

-bs; Save the graph window as a bitmap file with the specified dimensions

Syntax: save -bs PlotName FileName Width Height [B]

Save the graph window as a bitmap file with the specified dimensions. If B is included, save as a black-and-white bitmap.

-di/di1; Save the project as fileName

Syntax: save -di fileName or save -di1 fileName

Save the project as fileName. Name is fileName with extension of opju. If you are using an Origin dialog box, save the comments from the Save As dialog box with the project.


-dij; Save the project in .opj format

Syntax: save -dij fileName

Save the project in .opj format (the one loadable in Origin2017 and earlier versions). Name is fileName with extension of opj (old version).

-dix; Save the project in the extension determined by the supplied file name

Syntax: save -dix fileName

Save the project in the extension determined by the supplied file name filename. If fileName doesn't include an extension, Origin will append the extension .opju. For example,

save -DIX %yMyProject.opj; //saves the project in the opj format with the name MyProject.opj
save -DIX %yMyProject.opju; //saves the project in the opju format with the name MyProject.opju
save -DIX %yMyProject; //saves the project in the opju format with the name MyProject.opju.

-i; Save the active worksheet, graph, or matrix window to a file

Syntax: save -i fileName

Save the active worksheet, graph, or matrix window to a file. Name the file fileName, including the extension: OGWU for worksheet, OGGU for graph, and OGMU for matrix windows. The full path must be includede in fileName.

-iiT; Save the active workbook window to replace all the links with the actual values during saving

Syntax: save -iiT fileName

Save the active workbook window and Name the file fileName and replace all the cell links with the actual values upon saving. The full path must be includede in fileName. For example, the following command will save the active book as BookwithoutLinks.ogwu to UFF, with all the links replaced with their values.

save -iiT %YBookwithoutLinks.ogwu;

-iinT; Save the nth worksheet in the active workbook with all the links replaced with the actual values

Syntax: save -iinT fileName

Save the nth worksheet in the active workbook window as a single file fileName and replace all the cell links with the actual values upon saving. The full path must be includede in fileName. For example, the following command will save the second layer of the active book as BookwithoutLinks.ogwu to UFF, with all the links replaced with their values.

save -ii2T %YBookwithoutLinks.ogwu;

-ij; Save the active worksheet, graph, or matrix window to a file of old format

Syntax: save -ij fileName

Save the active worksheet, graph, or matrix window to a file of the old format, the one loadable in Origin 2017 and earlier versions. The extension of the saved file: OGW for worksheet, OGG for graph, and OGM for matrix windows. See details in Notes above.

-ik; Save the active workbook as an analysis template

Syntax: save -ik fileName

Save the active workbook as an analysis template, and the data in the workbook will be cleared up. Name the file fileName with the extension of OGWU. You can include the full path with fileName. Otherwise, the analysis template is saved to UFF directory.

-ix; Save the active window in the extension determined by the supplied file name

Syntax: save -ix fileName

Save the active window in the extension determined by the supplied file name filename. If fileName doesn't include an extension, Origin will append the correct extension. That is, if the current window is a workbook, it will then be saved in ogwu format; a graph window will be saved in oggu format; a matrix window will be saved in ogmu format. For example,

save -IX %YMyBook.ogw; //saves the active workbook in the opj format with the name MyBook.ogw
save -IX %YMyBook.ogwu; //saves the active workbook in the opju format with the name MyBook.ogwu
save -IX %YMyBook; //saves the active workbook in the opju format with the name MyBook.ogwu
save -IX %YMyGraph.ogg; //saves the active graph in the opj format with the name MyGraph.ogg
save -IX %YMyMatrix.ogmu; //saves the active matrix book in the opju format with the name MyMatrix.ogmu

-n; Save the winName notes window to a file

Syntax: save -n winName fileName

Save the winName notes window to a file. Name the file fileName with the TXT extension. You can include the full path with fileName. Otherwise, the file is saved to the UFF directory.

-t; Save windowName into a graph or worksheet template

Syntax: save -t windowName fileName

Save windowName into a graph or worksheet template, including the extension: OTPU for graph, and OTWU for worksheet. You can include the full path with fileName. Otherwise, the file is saved to the UFF directory. The %Y Register String Variable substitutes for the full path to UFF.

-tj; Save windowName into a graph or worksheet template of the old format

Syntax: save -tj windowName fileName

Save windowName into a graph or worksheet template of the old format, the one loadable in Origin 2017 and earlier versions. The extension of the saved file: OTP for graph, and OTW for worksheet. See details in Notes on top.

-tm; Save a graph window to a template with an attached EMF of the graph

Syntax: save -tm windowName fileName

Save a graph window to a template with an attached EMF of the graph. This EMF will then display in the graph template library.

-tx; Save the active window as a template in the extension determined by the supplied file name

Syntax: save -tx fileName

Save the active window as a template file in the extension determined by the supplied file name filename and dump information to the Messages Log. If fileName doesn't include an extension, Origin will append the correct extension. That is, if the current window is a workbook, it will then be saved in otwu format; a graph window will be saved in otpu format; a matrix window will be saved in otmu format. For example,

save -TX Book1 %YMyBook.otw; //saves the workbook Book1 as a template file MyBook.otw
save -TX Book1 %YMyBook.otwu; //saves the workbook Book1 as a template file MyBook.otwu
save -TX Book1 %YMyBook; //saves the workbook Book1 as a template file MyBook.otwu
save -TX Graph1 %YMyGraphTempl.otpu; //saves the graph Graph1 as a template file MyGraphTempl.otpu
save -TX MBook1 %YMyMatrixTempl; //saves the matrix book MBook1 as a template file MyMatrixTempl.otmu

-w; Export the worksheet wksName to an ASCII file

Syntax: save -w wksName fileName

Export worksheet wksName to an ASCII file. fileName must be a full path description.

-wh; Export the worksheet wksName to an ASCII file using the wks.export.cntrl object property

Syntax: save -wh wksName fileName

Export the worksheet wksName to an ASCII file using the wks.export.cntrl object property. Same as the -w option except this option uses the wks.export.cntrl object property to determine if headers are exported. Additionally, this option allows for a specific data range to export, using the wks.export.c1, etc. object properties.

-v; Save all system variables into fileName

Syntax: save -v fileName

Save all system variables into fileName.

Examples:

Example 1

This example imports a sample data, do some calculation and create a graph, and then exports the data, graph, and project to files to \myfile\ subfolder of UFF.

doc -s;
doc -n; 
//Import data and calculate moving average
string fn$=system.path.program$ + "Samples\Signal Processing\Step Signal with Random Noise.dat"; 
impasc fname:=fn$ options.Script.RunScriptAfterAllImport:="wks.addCol();csetvalue col:=!3 formula:="movavg(B,0,2)";Col(3)[L]$ = MovingAvg;";

string bkname$ = page.name$;                                       
string shname$ = wks.Name$;

//save modified data as an ASCII file
wks.export.cntrl=7;
save -w [bkname$]shname$! %Ymyfiles\mydata.dat;

//plot a double-Y plot and save it as an OGGU file
plotxy (1,2) plot:=200 ogl:=[<new template:=PAN2VERT name:="maygraph">] legend:=0; 
plotxy [bkname$]shname$!(1,3) plot:=200 ogl:=2 legend:=0;

//save graph as an OGGU file
save -i %H %Ymyfiles\mygraph;

//save current project as an OPJU file
save %Ymyfiles\mygroject;