Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
slooff
Posted - 02/02/2010 : 04:36:19 AM Origin 8 SR^ (Select Help-->About Origin): Operating System: Windows
Hi,
I want to import a data file that has a specific name: ec091203-03s_1 and automatically rename it to ec091203-03s_l.
Can this be done using an import script or with an import filter?
I need to do the dame for a similar file, but than the filname is ec091203-03s_2 and automatically rename it to ec091203-03s_d
Next I want to use these worksheets to subtract one from the other and therefore I need to see if the dataset is 'd' or 'l'.
Can somebody advise me how to do this?
Thanks!
Lenneke
1 L A T E S T R E P L I E S (Newest First)
greg
Posted - 02/02/2010 : 2:19:02 PM Since LabTalk has no file rename you would need to use OriginC which has a RenameFile function plus some other functions for parsing a filename which you should find useful. After you have written your OC file which might have two functions - one for each rename type - then you can create a filter for each type which does the appropriate rename at the end of the import.
So you might start with the dlgfile XF which will get filename into fname$: dlgfile gr:=*.*; Then use your filter with your code to do the import impfile filter:=RenameType1 location:=user; The RenameType1 filter has script that runs at the end of the import to load and compile your OriginC code and then calls the correct rename: if(!run.loadoc(MyRenames.c)) RenameType1(%(fname$)); else ty Could not load oc function.;
Your script after import could also tag the worksheet in some way so you can later identify it as 'd' or 'l'. Here is one possibility: wks.userparam1$ = RenameType; // Add a user-defined header wks.userparam1 = 1; // Show it in worksheet col(1)[RenameType]$ = D; // Set value in column 1 to "D"