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
 Import just 2 Files convert them and then the next
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

BrOsCoRe

Germany
9 Posts

Posted - 07/05/2015 :  06:19:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi guys,
I got another question.

[Main]

win -cd %H;
newbook template:=test123 sheet:=1;
string path$;

path$ = "Y:\Daten\Anode\Komma";
findfiles ext:="s*.dat";
impAsc
options.Sparklines:=0
options.template:=test123;

@glob=1;
string iniwks$ = %H;

xyz_renka 3 20 20;
worksheet -p 242 FERTIG;
%T = %H;

doc -e w{
if(!(iniwks$==%H))
{
xyz_renka 3 20 20;
range rr = [%H]1!1;
win -a %T;
layer -i rr;
layer.Unit = 4;
}
}

@glob=0;

doc -e p{
expGraph filename:=%E
type:=jpg path:= "Y:\Daten\Bilder"
tr.Margin:=2
tr1.Unit:=2
tr1.Width:=1920
tr1.height:=1080
tr2.TIF.DotsPerInch:=800
tr2.TIF.Compression:=LZW;
}

doc -s;
run.section(auto1,Main);

So if i use the code like that there are 2 problems.
First is that if i import to files everithing works fine but if i open to new files he takes all allready importet files and put them together in on graph. But what i want is to import to Files put them into a graph and the import the next to files and put them into a new graph. That would be perfect if this could be kida loop.

My second problem is that i first want to import a file from path(example): "D:\DATA\FILE1\file1.dat"and i want to import a file from another path: "D:\DATA\FILE2\file1.dat"

is there any way to do this.

thanks for all the help.
Greetings
Bro

jasonzhao

China
262 Posts

Posted - 07/05/2015 :  10:26:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

For the second problem, you can pre-define the file path as a string array

StringArray path_s;
path_s.Add("D:\\");
path_s.Add("E:\\"); //add path a element of string array

then, get one StringArray element in your loop,remember to use the statement "ii++";

int ii=1;
string path$;	
path$ = path_s.GetAt(ii)$;
ii++;


For the first problem, I am not really understand "if i open to new files he takes all allready importet files and put them together in on graph", would you please make further interpretation or illustrate the problem with screenshot?

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 07/06/2015 04:03:04 AM
Go to Top of Page

BrOsCoRe

Germany
9 Posts

Posted - 07/06/2015 :  01:50:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So at first thanks for the help with my second problem.
Ok i will explain it to you.x

If i am using this code it import now 2.dat files convert them and put them together in one graph. Then it exports the graph as jpg. OK fine.
But if i am gonna open the next to .dat files there are 4 opened at all in origin. So the code will take all the 4 files and put them together in one graph.
But what i like to have is that it import to files convert them, export them import next 2 files convert them and export them in a new graph. So that there are 2 files for one graph everytime.
I hope you undestand what i mean.

Greetings
Bro
Go to Top of Page

BrOsCoRe

Germany
9 Posts

Posted - 07/06/2015 :  03:27:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I tried now to put this code into mine but it don't work

Could you pls show me how I need to include your code
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 07/06/2015 :  04:02:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

The LabTalk Object StringArray which can save the string paths as array, you can refer to this page for further informations:
http://www.originlab.com/doc/LabTalk/ref/StringArray-obj

In fact, The operations execute by Script is always related to OPJ file, without OPJ file, it is difficult for us to debug this code, and get the results exactly you wanted

To show how to include string array in your code, sending the OPJ file to us (tech@originlab.com) to make a further test and debug is recommended.

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 07/06/2015 04:05:56 AM
Go to Top of Page

BrOsCoRe

Germany
9 Posts

Posted - 07/06/2015 :  04:12:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
But isn't the code in an ogs file.
I don't understand why I should send you an empty opj.
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 07/06/2015 :  04:24:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You are right, before the code execute, the OPJ is an expty OPJ, but after the code execute, the OPJ contained data and graph. If you can send us the OPJ file (after executing script) to us to take a look,which should be intuitively, I think we can understand better to both the first and second questions in this post.

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 07/06/2015 04:25:29 AM
Go to Top of Page

BrOsCoRe

Germany
9 Posts

Posted - 07/06/2015 :  04:28:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok i will send it to as soon as i am at home.
So it will be in about 5-6 hours
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 07/06/2015 :  04:33:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, You can mentioned the Link of the Forum post in your email content:
http://www.originlab.com/forum/topic.asp?whichpage=1&TOPIC_ID=21077

so I will find the email fast.

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 07/06/2015 04:34:28 AM
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