The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Open Multiple Projects

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cab0008 Posted - 06/29/2011 : 5:37:27 PM
Hello everyone,

I was wondering if anyone knew of any good function to use such as Project.open but gave the ability to have two projects open at the same time.
The reason I would like to do this is to transfer data to and from different projects using code similar to an import, but with the extra capability of full data manipulation over the projects.
The code I have written so far is shown below, but my hope is to add to it so that in the long run it will take several different bits of datasets and combine them in various ways in the main "Combined" project and then create plots of the data to export for presentations.
This is what I have so far:

void Combine()
{
string strCombineFile;
string strPathToProject;
StringArray strOPJpaths,strFiletypes;
strFiletypes.SetSize(1);
strFiletypes[0]="[ORIGIN PROJECTS]*.opj";
//save Compilation file to be created
if(0==get_saveas_box_by_file_group(strCombineFile,"Origin", "SaveFileAs"))
printf("User selected cancel");
else
{
bool bOK = Project.ActiveFolder().SaveAsProject(strCombineFile, SFC_INCLUDE_SUBFOLDERS | SFC_INCLUDE_ATTACHED_FILES);
out_str( "Files Saved as :\n" + strCombineFile );
}
//gather data from multiple files
int NumFiles = GetMultiOpenBox(strOPJpaths,strFiletypes, NULL, NULL, "Select Files for Comination", false);
if(NumFiles>0)
{
//open Comined destination file and create worksheet
Project.Open(strCombineFile);
WorksheetPage wpCombGreen;
wpCombGreen.Create("origin");
wpCombGreen.SetName("DATA532");
Worksheet wksCombGreen;
wksCombGreen.Create("Origin");
//put X dataset into Combined Project
Dataset dsXGreen;
dsXGreen.Attach(wksCombGreen,0);
Project.Save(strCombineFile);

Project.Open(strOPJpaths[0]);
Worksheet wksToCopyGreen("[DATA532]Sheet1");
vector vToCopyGreen(wksToCopyGreen.Columns(1),0,wksToCopyGreen.GetNumRows()-1);
Project.Save(strOPJpaths[0]);

Project.Open(strCombineFile);
dsXGreen = vToCopyGreen;
Project.Save(strCombineFile);
//open all files and place data into destination
for(int i=0; i<NumFiles; i++)
{
strPathToProject=strOPJpaths[i];
Project.Open(strPathToProject);
Worksheet wksToCopyGreen("[DATA532]Sheet1");
vector vToCopyGreen(wksToCopyGreen.Columns(4),0,wksToCopyGreen.GetNumRows()-1);
Dataset dsYCombGreen;
dsYCombGreen.Attach(wksCombGreen,i);
dsYCombGreen = vToCopyGreen;
Project.Save(strPathToProject);
}
Project.Save(strCombineFile);
}
}

I know this may not be the optimal way to write this but I hope it's at least somewhat in the right direction.
Any help with this is greatly appreciated.

Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:
1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 06/30/2011 : 02:20:26 AM
Hi,

Origin cannot open two projects at the same time. However, you can use the Project.Open() method to append other projects as folders in the current opened project. In your code, you just copy some column data from selected projects to the specified project. To get the data in project, you need to open/append the project first. So, you have gotten the right direction.

Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000