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
 LabTalk Forum
 Use fdlog more than once

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
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

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