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
 Copy notes window
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 06/30/2002 :  11:43:52 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there a LabTalk or OriginC technique for assigning the contents of a notes window to a string variable? Alternatively, can you save the text to a file? (I know how to assign the contents of a text file to %Z.)

Mike Buess
Origin WebRing Member

easwar

USA
1965 Posts

Posted - 06/30/2002 :  5:20:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

You can directly access the text in a notes window in Origin C:

void dd(string strNoteWinName)
{
Note noteWin(strNoteWinName);
string strNoteText = noteWin.Text;
printf("Contents of note window: %s\n%s",strNoteWinName, strNoteText);
}

Easwar
OriginLab.
Go to Top of Page

CStorey

Canada
137 Posts

Posted - 06/30/2002 :  8:13:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

You can use the Save -n LabTalk command to save Notes windows as text files.

Eg. Save -n [NotesWindowName] "%YDP\DP-DebugTrace.TXT";

Hope this helps,
Craig

Craig Storey
Origin WebRing Member - http://g.webring.com/hub?ring=originwebring
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/01/2002 :  10:44:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for both tips. I should be all set now!

Mike Buess
Origin WebRing Member
Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/10/2003 :  08:18:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Let me ask again because I want to manipulate and extract text from a Notes window.

Isn't there a LabTalk (not C) command without the detour of writing and reloading a file from disk?
Why isn't there anything straightforward like %Z=NotesWindow!text$; ???

May be I should think about switching to Origin C...?
Is there anywhere a good tutorial (a better one than the LabTalk manual for LabTalk?)
Thanks, Tilman.

By the way how do you store a text file from disk into %Z ? (with LabTalk)



Edited by - tib on 10/10/2003 08:33:43 AM
Go to Top of Page

cpyang

USA
1407 Posts

Posted - 10/10/2003 :  08:49:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Why isn't there anything straightforward like %Z=NotesWindow!text$; ???


LabTalk interpreter converts %Z etc into actual text before making assignment '='. The assignment by the interpreter has a limitation on the total length of the statment, so sooner or later, problem will occur. I am trying to explain that LabTalk was not intended as a programming environment, and various limitations prevent LabTalk from being such.

Origin C, on the other hand, is a true programming language and since Origin C codes are compiled, such that errors in the code can be checked first by the compiler to prevent unintended results, which is quite often observed with LabTalk.

CP


Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/10/2003 :  09:12:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi CP,
OK, I understand... in the longterm I should better switch to Origin C.
But do you know the way how Mike assigns a text file to %Z in LabTalk?
This should also work for me for the time being.
Thanks, Tilman.


Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/10/2003 :  10:08:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tilman,

You can read a text file with the LabTalk file utilities module (FUM), but I think I was talking about an Origin C method above. Probably using stdiofile. It reads the file a line at a time and you could tack each line to the end of %Z. The FUM method is essentially the same.

...Actually, the easiest way to read a file into %Z is with a combination of LT and OC methods.

1. Open the file into a Notes window with LT's open -n.
2. Read Notes1 with the following OC function.

string ReadNotes(string strNoteWinName)
{
Note noteWin(strNoteWinName);
return noteWin.Text;
}

The labtalk script would look like this...

open -n filename Notes1;
%Z=ReadNotes(Notes1)$;

...Notice the correction to argument of the ReadNotes function.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/10/2003 10:21:33 AM

Edited by - Mike Buess on 10/13/2003 1:12:53 PM
Go to Top of Page

tib

Switzerland
105 Posts

Posted - 10/13/2003 :  5:07:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,
thanks for your comments. Since I haven't dealt with Origin C your solution is not yet that simple to me.
By the way, I thought, I had a simple and pure LabTalk solution:
Just import your text file into a worksheet and say that 9999 lines are the header. After import you can find the text in %Z.
However, obviously it seems that Origin does not allow you to import a pure text file into a worksheet.
Error: file.txt does not seem to consist of ASCII data.
What a pitty. As usual, it could be simple but then it doesn't work.
Again, it seems that I really have to learn Origin C to get simple straightforward tasks done.
Thanks anyway, Tilman.

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/14/2003 :  10:27:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Tilman,

Once your comfortable w/OC I think you'll find that more and more tasks will become simple and straightforward. Other than learning a whole new suite of functions there are (IMO) only two things you'll need to get over when stepping from LT to OC...

1> Stricter syntax (don't abbrev., watch out for caps, etc).
2> All variables must be declared before they can be used. This can still be a PITA for me at times, but the rewards have been worth it so far.

This task (reading text file) might be a good place to start.

Mike Buess
Origin WebRing Member
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