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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 delete line from the notes

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pb Posted - 02/21/2004 : 12:15:20 PM
Is it possible to use the script to delete a specific range of lines from the notes?
Thanks
paola
2   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 02/21/2004 : 6:16:16 PM
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);
}
Mike Buess Posted - 02/21/2004 : 12:35:25 PM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000