Author |
Topic |
|
peter.cook
UK
356 Posts |
Posted - 08/30/2007 : 2:04:04 PM
|
Origin Version (Select Help-->About Origin): 7.5 SR6 Operating System: Win2000
Hi,
I may have had some discussions about this previously but what I want to ask is : can I amend the attached files (to an OPJ) programmatically in any way. I can open the OPJ and amend the attached files but I then have to open the codebuilder in order to ensure that the amend attached files are saved with the project. It would be really useful if there was any way I could to do this without programmatically. A scenario is to update 100s OPJ files containing data with new code for data analysis. Any bright ideas?
Cheers,
pete
|
|
greg
USA
1378 Posts |
Posted - 09/25/2007 : 10:22:51 AM
|
When you save an Origin Project file with files stored in Code Builder's Project Folder, these files are placed in a user's temporary folder when the OPJ file is opened. All you need to do is open the OPJ, find that temporary folder, replace the file(s) then update the OPJ.
This OriginC function will replace a file (strFile) in the Project folder of the selected Origin Project file (strOPJ) with a replacement file (strNewFile). The strOPJ and strNewFile must be full path and filenames, while strFile is just the name of the attached file.
// SYNTAX : Update_OPJ(D:\MyProjects\My.OPJ,my.c,D:\MyNew.c) void Update_OPJ(string strOPJ, string strFile, string strNewFile) { // Open the OPJ file Project.Open(strOPJ); // Get the TEMP folder used by Origin char sztemp[MAXFULLPATH]; DWORD aa = GetTempPath(MAXFULLPATH, sztemp); // Locate the file needing updating if(FindFile(strFile, sztemp, "", FALSE)) { string strFullName = sztemp + strFile; // Delete the file DeleteFile(strFullName); // Copy the new file FileCopy(strNewFile, strFullName); string strcmd; // compile and save OPJ Project.FindFunction(strFile); Project.Save(); } else { // Problem out_str("Not found!"); } }
|
|
|
|
Topic |
|
|
|