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
 Forum for Origin C
 Custom Import filter: how to get number of files?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hofmaale

20 Posts

Posted - 11/03/2015 :  09:18:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Edited by - hofmaale on 11/03/2015 09:19:26 AM

jasonzhao

China
262 Posts

Posted - 11/03/2015 :  10:27:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

hofmaale

20 Posts

Posted - 11/04/2015 :  03:21:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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!

Edited by - hofmaale on 11/04/2015 03:23:36 AM
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 11/04/2015 :  10:04:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - jasonzhao on 11/04/2015 10:06:49 PM
Go to Top of Page

hofmaale

20 Posts

Posted - 11/05/2015 :  03:44:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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...
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