Please help me with Anchors and Lotusscript

I do not understand the instructions for Anchor links. I want to create an anchor link, and then open a document in edit mode at that link. I want to do this in the Notes client using Lotusscript.

  1. I created a rich text field. Edited the document and moved the cursor to the RTF. I said, Edit - Copy as Link - Copy as Anchor Link (according to the Notes Help). Then I got a popup box (not mentioned in the Notes Help) with some text (“Project Management”) in it. Why am I getting this popup?

  2. Then it displays the anchor link, which is mentioned in Help. I saved and closed the document.

  3. Next, I paste in a Memo form, and click the link that’s pasted in. It takes me to the correct place in the target document (so far, so good – if a bit confusing).

  4. Now I want to open the document to that anchor using Lotusscript. From the Help, notesUIWorkspace.EditDocument’s fourth parameter is “documentAnchor$”. What is this string? Is this that popup that was displayed in step 1? How come, when I try to paste into the Programming Pane, I get some confusing text:

WIP DEVELOPMENT - Project Management

<REPLICA 85257383:004DAAB3>

CN=interdev7/O=ogilvy

WIP DEVELOPMENT

4 cont’d) What the heck is that?

  1. Also, how do get that text back if I want to paste it more than one time but I’ve lost what is on my clipboard (Windows users)? To get the Anchor text onto my clipboard, it seems the only way is to create a new Anchor link.

  2. Finally, I really want to do this in all documents created with this form. Any ideas how I can create the Anchor link in each document? (Or any other way to open to a particular tab or part of a document?)

Thanks if you can answer any (or hopefully all) of my questions,

-Jeff

Subject: Please help me with Anchors and Lotusscript

There is some relevant information in my article Rich Text 101 - Doclinks, but I’ll do my best to answer the different questions. My comments in this color.

  1. I created a rich text field. Edited the document and moved the cursor to the RTF. I said, Edit - Copy as Link - Copy as Anchor Link (according to the Notes Help). Then I got a popup box (not mentioned in the Notes Help) with some text (“Project Management”) in it. Why am I getting this popup?

An anchor is a text string which is used to identify a specific spot in a document. The popup is that text string. It should be unique for a single document, or only the first with that text string will be useful. Anchors come from a web construct where you can say www.mysite/mypage.htm#MyAnchor in which the MyAnchor string is teh equivalent to the anchor text in Notes.

  1. Then it displays the anchor link, which is mentioned in Help. I saved and closed the document.

Actually, this is not an anchor link, this is an anchor.

  1. Next, I paste in a Memo form, and click the link that’s pasted in. It takes me to the correct place in the target document (so far, so good – if a bit confusing).

This is the anchor link, which goes to a particular document

  1. Now I want to open the document to that anchor using Lotusscript. From the Help, notesUIWorkspace.EditDocument’s fourth parameter is “documentAnchor$”. What is this string? Is this that popup that was displayed in step 1? How come, when I try to paste into the Programming Pane, I get some confusing text:

WIP DEVELOPMENT - Project Management

<REPLICA 85257383:004DAAB3>

CN=interdev7/O=ogilvy

WIP DEVELOPMENT

You are pasting a link into a place it shouldn’t go, so it falls back on the NDL format, which is what it would use if you pasted into Notepad.

4 cont’d) What the heck is that?

As I said, a link in NDL format (used for .ndl files, which launch Notes to a particular document when launched)

  1. Also, how do get that text back if I want to paste it more than one time but I’ve lost what is on my clipboard (Windows users)? To get the Anchor text onto my clipboard, it seems the only way is to create a new Anchor link.

Sad, but true.

  1. Finally, I really want to do this in all documents created with this form. Any ideas how I can create the Anchor link in each document? (Or any other way to open to a particular tab or part of a document?)

Finally, an easy one. Create the anchor in the rich text field. Then, copy the anchor itself by selecting it as if were text (put cursor before it, hold down shift, click after it, CTRL-C). Now, switch to design mode and put the anchor on the form where you want it. Now it is available for all documents with that form. Now, you can use the NotesUIWorkspace.EditDocument as you suggested with the anchor text and it will open to the correct place. Note, you must open in read mode, not edit mode, for the anchor to work, but you can then switch to edit mode by setting the NotesUIDocument.EditMode to True.

Subject: EditDocument newInstance parm

Ben (or anyone),

I’ve almost got it working, except for putting the document back into edit mode.

If I call use notesUIWorkspace.EditDocument with the newInstance parm set to True, like this:

Call doc.Save(True,True)

Call uidoc.FieldSetText(“SaveOptions”,“0”)

Call uidoc.Close()

Set uidoc = ws.EditDocument(False, doc, True, dept, True, True)

uidoc.EditMode = True

It reopens the document, but will not put it into edit mode. In fact, if I click Edit, or Ctrl-E, the document will not go into edit mode. I do NOT have EditDocument’s notesDocumentReadOnly, the third parm, set to True, as you can see. That’s kind of wierd, right?

But if I change newInstance to False, then the document doesn’t reopen at all. So I can’t get it to open back into edit mode.

Any idea how to get it to open in edit mode?

Thanks,

-Jeff

Subject: RE: Please help me with Anchors and Lotusscript

Hi, Ben. This tip works. Thanks. I’ll get to your article soon, too.-Jeff