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
 Origin Forum
 Changing attached files

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
peter.cook 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

1   L A T E S T    R E P L I E S    (Newest First)
greg 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!");
}
}



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