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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 import script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

slooff

Netherlands
Posts

Posted - 02/02/2010 :  04:36:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

greg

USA
1378 Posts

Posted - 02/02/2010 :  2:19:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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"
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000