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 for Programming
 LabTalk Forum
 Import File with existing Filter

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
queryforum Posted - 09/17/2012 : 09:37:46 AM
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!
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 09/17/2012 : 2:30:16 PM
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.

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