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 for Programming
 LabTalk Forum
 Import File with existing Filter
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

queryforum

2 Posts

Posted - 09/17/2012 :  09:37:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1
Operating System: WinXP

Hello,
I need your held with this.
I have created an Import Filter in Origin (.oif).
Now i want to create a custom menu button that prompts me to open a .dat file and automatically uses the .oif File to take out the relevant data.
As you may know I need the "Labtalk script" for this

something like this:

getfile:"Ask for path";
impfile fn:="path" fi:="D:\ASCII_Import.oif";

would be great if this works for multiple files!

greg

USA
1378 Posts

Posted - 09/17/2012 :  2:30:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your impfile should work fine, so your real question is importing MULTIPLE files.

Here is some code that imports files found in ..\Samples\Import and Export:

// BEGIN SCRIPT
dlgfile gr:=ASCII mu:=1; // browse to Samples\Import and Export
loop(ii,1,fname.GetNumTokens(CRLF))
{
file$ = fname.GetToken(ii,CRLF)$;
impfile fn:=file$
fi:=VarsFromFileNameAndHeader.oif
location:=0;
}
// END SCRIPT
The filter file is stored in the same location (location:=0) as the data files:
S15-125-03.dat
S21-235-07.dat
S32-014-04.dat

dlgfile uses the mult-file option (mu:=1) to populate the fname$ variable with multiple lines.
fname.GetNumTokens(CRLF) returns the number of files (one per line)
fname.GetToken(ii,CRLF)$ returns the next filename.
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