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
 Script works only with some data 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

bmmaoso

Colombia
Posts

Posted - 10/05/2004 :  11:27:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version 6,0.

Hello!

I am working with origin importing some data files with labtalk, but I don't know why it works good only for some data files and only sometimes. when I import the data files I change the name and the label of the columns; and if I try to change it with script writing in the Script window there is a command error. And if I do it manually, there is a message indicating that this name is used for other dataset, but I can not see this name in the heading columns (that is not visually true). It is really strange.

My script just to import the data file and name the columns is:

win -t wks;
fdlog.numTypes=1;
fdlog.Type1$= "[All files (*.*)] *.*";
if (fdlog.open() != 0){
win -c;
};
open -w %A;
wks.col1.width=15;
wks.col1.name$=Date;
wks.col2.name$=Filter;
wks.col3.name$=Mass;
wks.col1.label$=Date;
wks.col2.label$=Filter;
wks.col3.label$=Mass;
wks.labels(0);

Could you help me to find what is wrong in the script?

Thank you very much

Maria

Mike Buess

USA
3037 Posts

Posted - 10/05/2004 :  12:44:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Maria,

In Origin 6.0 the command win -c deletes the worksheet window but does not delete its datasets (column data). Enter 'list s' in the script window and you'll see they still exist. Use this instead...

win -t wks; %W=%H;
fdlog.numTypes=1;
fdlog.Type1$= "[All files (*.*)] *.*";
if (fdlog.open() != 0) {
repeat wks.ncols {del col(1)}; // delete all columns
win -c %W; // delete window
break 1; // you probably want to quit now
};
- rest of script -

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/05/2004 12:46:38 PM
Go to Top of Page

bmmaoso

Colombia
Posts

Posted - 10/06/2004 :  08:07:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike!

Thank you for your help. But I imported some files many times and deleted them in the wrong way and now I have the dataset in the memory of my project, can you tell me please how can I delete the dataset from the memory? When I write 'List s' in the script window I can see them, but I don't know how to delete them.

Thank you very much

Maria
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/06/2004 :  09:02:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Maria,

Here is a pretty safe way to remove all unattached datasets. It makes a list of all datasets that are not columns in existing worksheets and also are not matrices and then deletes all datasets on the list.

%Z="";
doc -e S {
if(exist(%[%C,'_'],2)==0 && exist(%C,5)==0) %Z=%Z %C;
};
for(i=1;i>0;i++) {
%A=%[%Z,#i]; if(%A=="") break;
del %A;
};

...Although it should be safe I suggest you save your project before trying.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/06/2004 09:09:15 AM

Edited by - Mike Buess on 10/06/2004 09:12:57 AM

Edited by - Mike Buess on 10/06/2004 09:22:15 AM
Go to Top of Page

bmmaoso

Colombia
Posts

Posted - 10/06/2004 :  12:43:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike!

Thank you very much. I solved my problem.

Maria
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