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
 Custom Import filter: how to get number of files?

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
hofmaale Posted - 11/03/2015 : 09:18:57 AM
Hi,

annother "problem" (also mere cosmetic); For a custom import script, the function called from Origin has the prototype
int import_Files(Layer &lyTarget, TreeNode &trFilter, LPCSTR lpcszFile, int nFile)

It does not get the total number of files as a parameter, also the tree trFilter does not provide an a node with the total amount of files. Is there a possibility to get that number somewhere else?

A workaround would be to select the files using a select-files dialog and to not use the import filter-dialog at all, but I'm still interested in querying the total number of files selected in the Import-Dialog...

Thanks in advance,

Alex



Origin Ver. and Service Release: 2015G Sr1
Operating System: Win7 x64
4   L A T E S T    R E P L I E S    (Newest First)
hofmaale Posted - 11/05/2015 : 03:44:52 AM
Hi,

well, yes and no; of course I can use this to somehow count the number of times the function is called, but - the function itself will never see how many files will be imported, and it will not know when it's the last time.

I guess I have to create my own "Select File" dialog; I don't use the options in the Import-Dialog anyway, so I guess this will work better.

Thanks anyway...
jasonzhao Posted - 11/04/2015 : 10:04:51 PM
Hello,

There is one argument called 'nFile' which is 'The file index number in an ordered sequence of imported files';
The nFile begins with 0, in order to count the amount of files, please try the code below in your main function:


static int nTotalFiles;
int import_Files(Layer &lyTarget, TreeNode &trFilter, LPCSTR lpcszFile, int nFile)
{
    ...
    nTotalFiles = nFile;
}
nTotalFiles = nFile+1;


the nTotalFiles is the total number of files. Because If you import n files, your function gets called n times, nTotalFiles will increase n times.

For further information, please contact tech@originlab.com


Best regards!
Jason
OriginLab Technical Service
hofmaale Posted - 11/04/2015 : 03:21:08 AM
I mean the function behind the "User Defined Filters" (see http://www.originlab.com/doc/Origin-Help/ImpWiz-UserFilterPage or http://www.originlab.de/doc/OriginC/guide/Importing-Data).

Thanks!
jasonzhao Posted - 11/03/2015 : 10:27:47 PM
Hello,

Did you mean this import function?
http://www.originlab.com/doc/OriginC/ref/import_files

Or this one in Samples folder?
ImportIntegers(Layer &lyTarget, TreeNode &trFilter, LPCSTR lpcszFile, int nFile)

The prototype in webpage is not the same as that in your function.


Best regards!
Jason
OriginLab Technical Service

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