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
 delete line from the notes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

pb

Italy
8 Posts

Posted - 02/21/2004 :  12:15:20 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is it possible to use the script to delete a specific range of lines from the notes?
Thanks
paola

Mike Buess

USA
3037 Posts

Posted - 02/21/2004 :  12:35:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You need OriginPro to edit the text in a notes window with LabTalk. Then you can

1. Save the notes window text to file with save -n.
2. Manipulate the file with the File Utilities Module (OriginPro only).
3. Read the file back to the notes window with open -n.

It's much easier (and doesn't require OriginPro) if you use Origin C to access the notes window text directly...

Note noteWin(strNoteWinName);
string sText = noteWin.Text; // read text from notes window
-- manipulate text --
noteWin.Text = sText; // write text to notes window

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/21/2004 12:35:46 PM
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 02/21/2004 :  6:16:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
As Mile indicated... its a lot easier to do this in OriginC. The followign OriginC function should work ...


bool delete_lines_from_note(string strNotePageName, uint DeleteFrom, uint LinesToDelete)
{
/*
Deletes "LinesToDelete" lines from the NotePage "strNotePageName"
starting at Line number "deleteFrom" (zero offset)
*/
Note NotePage(strNotePageName);
if(NotePage)
{
string NotePageText=NotePage.Text;
string NotePageLine=, NewNotePageText="";
int pp=NotePageText.GetNumTokens('\n');
if(DeleteFrom>NotePageText.GetNumTokens('\n'))
{
return (true);
}
int i=0;
while (i<NotePageText.GetNumTokens('\n'))
{
if(i<DeleteFrom || i>(DeleteFrom+LinesToDelete-1))
{
NotePageLine=NotePageText.GetToken(i,'\n');
NewNotePageText+=NotePageLine;
NewNotePageText+='\n';
i++;
continue;
}
i++;
}
NotePage.Text=NewNotePageText;
return (true);
}
return (false);
}
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