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
 fill label on wks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DeiMudda

Spain
4 Posts

Posted - 06/06/2003 :  08:09:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

is it possible to fill a text-label on a worksheet with informations from a text-file or ascii-file?

thx for help

edgar.kaiser

Switzerland
29 Posts

Posted - 06/06/2003 :  08:50:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

you can import your text into a worksheet cell by the LabTalk OPEN command and then refer to that cell in your label text. That may be limited in text size.

Alternatively read your text file by an OriginC command (fread, fscanf, ...) and assign the result to your label.

If you have Origin professional use the UIM functions.

Several ways to do what you want. What the most convenient one is depends on your requirements.

Regards,

Edgar
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/06/2003 :  08:51:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If the information is in a fixed-length file header you can try the following while a blank worksheet is active...

1> File->Import->ASCII Options.
2> In first line of File Header section enter the number of lines in the file header.
3> Click Update Options, then Cancel.
4> Tools->Worksheet Script.
5> Check Run Script Automatically after Import.
6> Enter the following LabTalk script...

label -s -sa Header %Z;

7> Click Update, then Cancel.
8> Click the Save Template button on standard toolbar to save your changes.

The header text should now show up in a text label called Header when you import, although it might be difficult to see against the background of the wks columns. Note - this works in Origin 7, but I'm not sure about earlier versions.



Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 06/06/2003 08:56:28 AM

Edited by - Mike Buess on 06/06/2003 08:57:48 AM
Go to Top of Page

DeiMudda

Spain
4 Posts

Posted - 06/06/2003 :  10:13:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
wow,

thx for the quick responses, but..

the limit in text-size is a problem. I want to show additional informations e.g. boundary conditions to the data. Therefor i want to copy the full content of another txt/dat-file in the label. This informations are not in the same file as the data, but in the same folder (-> to get the path is not the problem.)

using OriginC commands would be nice, but the final project should work on Origin 5-7. On this account, i think that´s not possible with OriginC.

thx for further help ;)
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/06/2003 :  12:38:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you have Origin Pro your best bet is with the UIM module suggested by Edgar. If you don't have Origin Pro a variation on my approach might still work. The string variable %Z can hold over 8000 characters, so you could import the information file to a second template with Header lines set to a large number. Then copy the label from that worksheet to the data worksheet. The whole thing could be automated in LabTalk.

Mike Buess
Origin WebRing Member
Go to Top of Page

DeiMudda

Spain
4 Posts

Posted - 06/06/2003 :  3:30:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike: I tried your approach, but it didn´t work right. Could be my fault. ;)

By the way, is it possible to copy the content of a note window in the label? (open -n filename) -> ????
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/06/2003 :  3:50:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ah... open the file in a notes window and then copy to a label? Nice idea, but there's no LabTalk method that I'm aware of for copying the contents of the notes window. (It can be done in Origin C, but as you say that can only be used in Origin 7.)

Why not keep the information in the notes window? I think you can specify note window names even in Origin 5. You could add a button to the data worksheet that brings up the note window containing its information.

Mike Buess
Origin WebRing Member
Go to Top of Page

DeiMudda

Spain
4 Posts

Posted - 06/06/2003 :  5:09:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Also, a good idea.

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