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
 Forum for Origin C
 Programming File Import Filters

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
hajo_old Posted - 01/20/2003 : 09:06:51 AM


Hello, all

how can I program some file import filters for several file types we use at our company?

I thought of an integrated extension of the filter choosebox in the file-open dialog (e.g. *.xls; *.txt). We use severel text files with different encodings, comments and data formats. So by simply choosing the file type, the files should be read in into a workbook and for example the comments and units should be filled in.

we use the normal Origin 7 version (till now not the PRO Version).

Thanks for any hints or even better solutions!!

Hans-Jörg Koch
SiemensVDO
Germany
2   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 01/20/2003 : 12:56:10 PM
Meanwhile, you can set up your own filters in Origin 7 with a little effort. There are several approaches but I'll just discuss the method that seems easiest to me. In the following LabTalk script I assume you have two types of files, ASCII (*.dat, *.txt) and Excel (*.xls). I also assume that you have a template ready for each type (AsciiTemplate.otw and ExcelTemplate.otw) with the appropriate ASCII options already set up. Put the scripts in the [Main] section of Custom.ogs and launch them with the Custom Routine button.

run.section(File,Init); // initialize the file dialog
fdlog.dlgName$="Custom import"; // dialog title
fdlog.numTypes=4; // number of extensions
fdlog.type1$="[ASCII (*.dat)] *.dat";
fdlog.type2$="[ASCII (*.txt)] *.txt";
fdlog.type3$="[Excel (*.xls)] *.xls";
fdlog.type4$="[All files (*.*)] *.*";
if(fdlog.open(A)==1) break 1;
%B=fdlog.path$;
%Z=%B%A; %A=Origin;
// fdlog.deftype=extension number of selected file
switch (fdlog.deftype) {
case 1: %A=AsciiTemplate; break;
case 2: %A=AsciiTemplate; break;
case 3: %A=ExcelTemplate; break;
default: break;
};
win -t D %A; // open the appropriate template
open -wc %Z; // import the file

Consult the fdlog object in the LabTalk programming guide for tweaking options.

Hope this helps. Post back if you get stuck.

Mike Buess
Origin WebRing Member
eparent Posted - 01/20/2003 : 10:12:52 AM
In version 8 we plan to make it easier for users to add file types to Origin's File Open dialog and File Import menu. You tell Origin what extensions are associated with your files and then write your import routine in Origin C. Origin will handle the call to your import routine from File Open, File Import, and drag-and-drop.



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