LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: Still problems with $AssistAction

Still problems with $AssistAction (by Kenneth Haggman, 01/06/2005 09:14:39 PM)

Despite weeks of futile attempts, I still haven't managed to work around the issues with the $AssistAction item in LotusScript agents.

I have a Visual Basic application that reads subroutines and/or functions from the various design elements in a Notes database.

The user can re-arrange the subs/functions and I then write the re-ordered subs/functions back to the design element.

This works fine for Script Libraries. Forms, Views and other design elements.

The one left that's giving me headaches is the LotusScript agents.

I attempted to simply delete the $AssistAction item and the re-write with all the necessary data.

As you know, the $AssistAction item (in a LotusScript agent) starts with a header.

After some detective work, I have managed to find out that the header consist of two CD-records.

1. CDACTIONHEADER containing:

1.a. signature, 1 byte

1.b. length, 1 byte

2. CDACTIONLOTUSSCRIPT containing:

2.a. signature, 2 bytes

2.b. length, 2 bytes

3.c. flags, 4 bytes

3.d. scriptlength, 4 bytes

The scriptlength dword contains the length of the LotusScript code that follows.

The length integer contains the length of scriptlength + the size of the record.

So - if we have LotusScript code with a length of 400 bytes, the scriptlength dword will contain 400 and the length integer will contain 412.

No matter what I try, I never got it to work.

Using NSFItemAppend would write to the item, but any attempt to sign or save the design document would fail.

So I have now tried a different approach.

I know that the LotusScript text I want to write has the same length as the original text.

Therefore, I don't really need to re-write the whole $AssistAction item.

Instead, I have tried to write directly to the item's memory to replace the LotusScript part of the item.

This is what I do:

1. Run OSTranslate to translate VB native to LMBCS.

2. Call NSFItemInfo to get the first instance of the item.

3. Call OSLockObject to get a pointer.

4. Call ODSReadMemory to read the type (2 bytes) and the headers (14 bytes)

5. Call ODSWriteMemory to write my translated string to the item at the memory offset.

The call is: Call ODSWriteMemory(p, ODS_BYTE, strOut, retLength)

where p is the pointer, strOut is the ttranslated string, and retLength is the length returned from OSTranslate.

6. Call OSUnlockObject

Signing and saving the design document goes fine, but compiling doesn't, and that's easy to understand.

When I look at the $AssistAction item it doesn't contain the text I wanted there, but some other gibberish!

What am I doing wrong here?

Could it be the definition of ODSWriteMemory? This is what I use now:

Private Declare Sub ODSWriteMemory Lib "nnotes" (pSource As Long, ByVal typeODS As Integer, pDest As Any, ByVal Iterations As Integer)

I have tried to define pDest As String, but no difference.

Grateful for any help.