T O P I C R E V I E W |
WiljanVerhees |
Posted - 11/28/2018 : 09:03:45 AM Origin Ver. and Service Release (Select Help-->About Origin):originPro 2016 Operating System:windows10
I would like to import multiple files from different locations in subsequent runs of a script. I now use (fdlog.MultiOpen() != 0/0) for this which works great for the first time but during the next run nothing happens. Selecting the files from different locations is possible using fdLog but a bit cumbersome.
Tried fdlog.reset() but this is ineffective. Anyone who knows if a solution exists? Thanks.
Wiljan
wve |
5 L A T E S T R E P L I E S (Newest First) |
WiljanVerhees |
Posted - 11/30/2018 : 04:55:56 AM Hi Yuki,
It was just a matter of setting the worksheet getnames (indeed a template)active again .
Thanks for the support.
Regards,
Wiljan
wve |
yuki_wu |
Posted - 11/29/2018 : 10:15:52 PM Hi Wiljan,
Did you already create a workbook template named getname? You might use the window command in a wrong way.
Please take a look at this page first: https://www.originlab.com/doc/LabTalk/ref/Window-cmd#-t.3B_Create_a_new_window_from_the_template_file
Regards, Yuki
OriginLab
|
WiljanVerhees |
Posted - 11/29/2018 : 1:25:35 PM Hi,
with some simpeler code it works:
type -c "get filenames for data-analysis";
fdlog.reset(); fdlog.ShowComment = 0;
fdlog.UseGroup(Ascii);
fdlog.UseType(TXT)
if (fdlog.MultiOpen() != 0/0)
{ window -a book1; nn= wks.maxRows; type -a $(nn); num = fdlog.MultiOpen.Count; loop (ii, 1, fdlog.MultiOpen.Count) { if(ii<num) { FDlog.Get(A, ii); str$=%A; %([book1]sheet1,1,ii+nn)= "%A"; type -a "%A"; } }
Something else is causing the issue (when opening a template window???) but no idea what.
thanks.
Wiljan
wve |
WiljanVerhees |
Posted - 11/29/2018 : 03:27:35 AM Hi Yuki,
Thanks for the reply.
The script I'm using is:
[Getnames] type -c "get filenames for data-analysis";
fdlog.reset(); fdlog.ShowComment = 0;
fdlog.UseGroup(Ascii);
fdlog.UseType(TXT);
if (fdlog.MultiOpen() != 0/0)
window -t wks getNames getNames; window -r book1 allnames; window -a allnames; allnames!page.active=1; nn= wks.maxRows; type -a $(nn); num = fdlog.MultiOpen.Count; loop (ii, 1, fdlog.MultiOpen.Count) { if(ii<num) { FDlog.Get(A, ii); str$=%A; j=(str.reversefind('\'))+1; k=(str.reversefind('.'))-1; %K=%[%A,j:k]; %B = System.path.Ascii$; %([getnames]information,1,ii)= "%B"; %([getnames]information,2,ii)= "%K"; %([allnames]sheet1,1,ii+nn)= "%B"; %([allnames]sheet1,2,ii+nn)= "%K"; } else { FDlog.Get(A, ii); str$=%A; j=(str.reversefind('\'))+1; k=(str.reversefind('.'))-1; %K=%[%A,j:k]; %B = System.path.Ascii$; %([getnames]information,1,ii)= "%B"; %([getnames]information,2,ii)= "%K"; %([allnames]sheet1,1,ii+nn)= "%B"; %([allnames]sheet1,2,ii+nn)= "%K"; } }
The goal is at first to gather all filenames of datafiles in a sheet so I can select the ones I need and put them in the order I want to have. With another script I then extract the data.
wve |
yuki_wu |
Posted - 11/28/2018 : 9:57:57 PM Hi Wiljan,
I am sorry that I cannot understand you fully. So what do you mean using fdlog more than one?
I made a very simple example, and it works fine:
loop(ii, 1, 3)
{
fdlog.reset();
fdlog.usegroup(ASCII);
if (fdlog.MultiOpen() != 0/0)
{
type -a $(fdlog.MultiOpen.Count);
}
} Could you please tell me more details or paste a piece of your code here?
Regards, Yuki
OriginLab
|
|
|