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
 LabTalk Forum
 Use fdlog more than once
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

WiljanVerhees

Netherlands
7 Posts

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

yuki_wu

896 Posts

Posted - 11/28/2018 :  9:57:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

WiljanVerhees

Netherlands
7 Posts

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

WiljanVerhees

Netherlands
7 Posts

Posted - 11/29/2018 :  1:25:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

yuki_wu

896 Posts

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

WiljanVerhees

Netherlands
7 Posts

Posted - 11/30/2018 :  04:55:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

It was just a matter of setting the worksheet getnames (indeed a template)active again.

Thanks for the support.

Regards,

Wiljan

wve
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