开发者

How do I copy specific text from a document in edit mode and add it to the subject line?

I'm far from an expert, but I've learned quite a little bit about using the Lotus @Formula language recently and have created some very useful buttons for myself. Unfortunately, I'm having trouble trying to put the finishing touch on one I recently created and no matter how much searching I do, I can't seem to find anything to point me in the right direction.

To be more specific, what I'm trying to do is forward a note that takes a piece of text from the body of the email and uses it in the subject line. The note that I'm forwarding could either be a memo or a document from a specific database. When I forward a document from the database, I can get the text I need by getting the value of a specific field before it forwards it by using @GetField. If I'm only forwarding directly from a document from the database, it works perfectly by first getting the value, which is good because once I open that new memo to forward it, that field is no longer there.

The problem is that if I'm forwarding someone else's email (someone who already forwarded a document from the database), I have no opportunity to first get the value I need because that field is already gone. The good news is that the value of the field I'm trying to get is listed in a table of the memo that I'm forwarding. Unfortunately, I can't figure out how to get that text highlighted and copied so I can have it pasted in the subject line. In my simple mind, I'm thinking I just need a way to "find" the static text that precedes the text I need to copy, move one space to the right, and highlight and copy everything from that point to the end of the cell.

Basically, I need a way to find and copy something from the body so I can use it in the subject line. The closest thing I could get to work is to move the cursor to the spot by using EditDown and EditRight commands. The problem with that method is that I have no way of knowing the correct number of lines to move down. If I were forwarding the original document, the following sort of works:

@Command( [EditGotoField]; "Body" ) ;
REM "The next line only works if the text is located exactly 33 lines down." ;
@Command( [EditDown]; "33" ) ;
@Command( [EditRight]; "29" ) ;
@Command( [EditDeselectAll] ) ;
REM "The next line only works if the text I need is three characters开发者_StackOverflow中文版 long." ;
@Command( [EditRight] ; "3" ) ;
@Command( [EditCopy] ) ;
@Command( [EditGotoField] ; "Subject" ) ;
@Command( [EditSelectAll]) ;
@Command( [EditInsertText] ; "The text I need is: " ) ;
@PostedCommand( [EditPaste] ) 

I say "sort of" because the part where it selects text only works if the text I need happens to be the same number of characters that I've specified in the code. If the text I need is longer, it won't get it all. If it's shorter, the cursor selects the next cell and then copies a bunch of unnecessary text. I need a way to make it only select to the end of the cell (i.e. as if hit 'Shift' + 'End').

I thought maybe I could call an agent to perform this piece, but I couldn't find anything helpful in my searches for LotusScript.

I also thought that maybe the email I'm forwarding might have some link back to the original document, but I'm unable to find anything. My thinking was that maybe it could find the original document, get the value I need and go back to the note.

Thanks for taking the time to read this. If anyone can help, I'd really appreciate it.


Suggest you take a look at @Text or @Abstract to grab the text from the body field of the memo, that'll leave you with a string to handle, you've mentioned you've some static text before the text you want so @middle may be your friend here. HTH.

Hi Mike, @Abstract will handle a maximum 64994 bytes which should be enough for an email. The field you want is actually called Body, so try

@Abstract([TextOnly]; 64000; ""; "Body")

I tried assigning this to a variable only to discover formula string variables are limited to 1700 characters so instead I used it directly in @Middle,

@Middle(@Abstract([TextOnly]; 64000; ""; "Body"); "YourFixedText1"; "YourFixedText2"))

I then wrapped an @Prompt around it for testing,

@Prompt([Ok];"Test Extract"; @Middle(@Abstract([TextOnly]; 64000; ""; "Body"); ""YourFixedText1""; "YourFixedText2"))

Once you're successfully extracting what you want use the formula to set the Subject field of your forwarded note.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜