Close the current project and start a new one.
VB: Function NewProject As Boolean
C++: bool NewProject
C#: bool NewProject
Returns true if successful else false.
Sub Application_NewProject() Dim app As Origin.IOApplication app = New Origin.ApplicationSI If app.IsModified Then 'If modified, backup it first app.Save(app.Path(Origin.APPPATH_TYPES.APPPATH_USER) + "beforeNewProject.opj") MsgBox("Save the previous project as " + app.Path(Origin.APPPATH_TYPES.APPPATH_USER) + "beforeNewProject.opj") End If If app.NewProject Then 'create an empty project MsgBox("New project created!") End If End Sub
using Origin; static bool testNewProject() { // Connect to Origin. Origin.ApplicationSI originApp = new Origin.ApplicationSI(); // Check if the current project has unsaved changes. if (originApp.IsModified) { // Create the full path and name of a project file in the User Files Folder. string strFullFileName = originApp.Path(APPPATH_TYPES.APPPATH_USER) + "beforeNewProject.opj"; // Save the current Origin session to a project file. originApp.Save(strFullFileName); } // Close the current project and start a new one. return originApp.NewProject(); }
import OriginExt as O import tempfile app = O.Application(); app.Visible = app.MAINWND_SHOW pageName = app.CreatePage(app.OPT_WORKSHEET) testData = [[5,87,90], [3.14, 24.6, 68.09]] app.PutWorksheet(pageName, testData) # Save the project tempDir = tempfile.mkdtemp() tempFile = tempDir + "\\OriginExtTest.opju" app.Save(tempFile) app.NewProject() app.Load(tempFile)
8.0SR2