Hello all,The following agent script is part of a small app that automates the creation of a Link Hotspot. This app is available at the sandbox and was slightly modified to meet our needs in house. This all worked fine in a Notes 5 client against our R5 Server. Recently, I have upgraded a few clients to R6 in preparation for our company wide upgrade and noticed that this app no longer functions as expected.
After turning on Debugger, I discovered that the line marked with Asterisks is where I receive the “Document Commmand is not available” error.
Can someone please help me to understand what changed across versions that would make this fail?
Thanks so much!
Doug Niman
Seattle , WA
Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim filename As String
Dim TempFileName As String
'Select the file.
n$ = String$(1024, " ")
f$ = "All Files|*.*|Acrobat Files|*.PDF|Excel Documents|*.XLS|Word Documents|*.DOC|PowerPoint Presentations|*.PPT|PowerPoint Slides|*.PPS|"
ret% = NEMGetFile( 0, n$, f$, "Create File Link Hotspot")
If ret% = 0 Then Exit Sub
filename = Fulltrim(n$)
'Get the working document.
Set uidoc = workspace.CurrentDocument
'Clear the link field.
Call uidoc.FieldSetText( "Link", "" )
'Construct the html code.
Call uidoc.FieldSetText( "HTML", "<html><a href=""file:\\" + filename + """>" + filename + "</a></html>" )
s = uidoc.FieldGetText( "HTML" )
'Write the html code to a temp file.
fileNum% = Freefile()
TempFileName$ = "c:\LinkHotspotCreator.htm"
Open TempFileName$ For Output As fileNum%
Print #fileNum%, s
Close fileNum%
'Import the html file into a rich text field.
uidoc.GotoField( "Link" )
Call uidoc.Import("HTML File",TempFileName$)
'Copy to clipboard.
Call uidoc.GoToField( "Link" )
Call uidoc.SelectAll
Call uidoc.Copy <**** Error Here ****>
Messagebox "You can now paste your link into any richtext field.", 0 + 64, "Create File Link Hotspot"
'Clean up.
'Kill TempFileName$
'Call uidoc.Close
End Sub
Subject: Document Command Not Available - Notes 6 Client Only?!?
Don’t know about this change, but can I suggest you put the code in an action button, and do away with the Link field? Instead, tell the users to first put the cursor in the rich text field where they want the link, and then use the action button. Just import the HTML wherever they happen to be. That does two nice things – saves them the step of copying, and preserves the contents of their clipboard.
Subject: RE: Document Command Not Available - Notes 6 Client Only?!?
Thanks for the reply. You know I did try that and I could not get it to work properly. Every time we try to write HTML to the page everything gets wiped out. So the users get blank emails. This is especially bad for users that get their mail via a browser.
I had posted another topic on trying to understand how the HTML signature worked - because that is very similar. In that case you are appending HTML to the bottom of an e-mail and nothing gets overwritten.
Anyway, I can’t understand why Lotus won’t just solve this by providing an easy way for end users to create links to network files. This would be a great advantage - especially for shops that migrated from Exchange/Outlook.
I am primarily a really good Domino Admin type with at best, Jr. Development Skills - so any “specific” tips are of great help to me as I continue to learn how all of this works.
Sincerely,
Doug Niman
Subject: RE: Document Command Not Available - Notes 6 Client Only?!?
You say,
“…I did try that and I could not get it to work properly. Every time we try to write HTML to the page everything gets wiped out. So the users get blank emails. This is especially bad for users that get their mail via a browser.”
Perhaps I’ve misunderstood. From looking at your code it appears that you’re trying to provide an action button for users that lets them insert a link to a file while they’re editing a Notes document in the Notes client. So this is an email message they’re working on, I understand that, but your reply really puzzles me.
First, you say, “Every time we try to write HTML to the page everything gets wiped out.” I interpret this to mean that when you use the Import method, it totally replaces the contents of the rich text field. This wouldn’t happen if you didn’t SelectAll first.
But from your remarks following that, it sounds like you’re saying that the email is not blank when it’s sent, but is blank when it’s received. Can you elaborate on that, with specifics as to field names, code in your action button, etc.?