Synthesizing Keystrokes via keybd_event does not work in LN 8+ like is did in LN 5/6/7

One of our products uses keystroke synthesis via the Windows function, keybd_event, to add attachments to a new memo (document). The code works perfectly in LN 5, 6, and 7. However, porting over to LN 8 and testing the same code exhibits problems. Mainly there is a noticeable timing issue with the calls. Some of the keys seem to get lost or dropped. Even adding “Sleep 20” (sleeping for 20 milliseconds is for testing only), sometimes the synthesized keystrokes are processed correctly and sometimes there is a huge delay and the attachment will fail as some keys are dropped.

Note that the source language for this code is VB 6.

Has anybody seen this behavior and is there any known work around or alternative that will work consistently?

Subject: I have seen PMRs on it

Hi,

I have seen a couple of PMRs on this issue, but as the name says I regret I am not in a position to give more details at this time. :confused:

I recommend you open a PMR on it if you can. Otherwise I will check into it tomorrow for you if no one has responded by then.

Subject: Thank You

We are a Business Partner but that does not give us the ability to open PMRs. I have tried. I think this is a bug but I can only find limited info on others having the same issue which is surprising.

Thanks for your reply.

Subject: Not exactly the same.

I had a look at PMR I saw it from and it wasn’t the exact same issue. They are using keyb_event from within an agent and it is not working as expected. Doesn’t mention timing issues.

Are you using the basic or standard client when running the VB app?

Subject: LN Version

The LN client is Lotus Notes Release 8.0.2 Standard Configuration

Subject: Does it happen in basic mode?

You can test with the /basic command line.

If you want you can send me a sample app to reproduce the issue. I can create an SPR then. However as it is not a PMR I will not be able to create a customer report or investigate it in great detail. :-/

Subject: Tested without error in LN 8 Basic Configuration

In the few tests I ran after installing the Basic Configuration, the keystroke synthesis code worked fine. The keystrokes that synthesize File->Attach-><path_to_file><filename> worked with no apparent delays and errors as found in Standard Configuration.

I would like to provide you a sample app if I have the time to build one.

Thanks for the response.

Subject: Sure send me the file.

sod1684 @ ie.ibm.com (remove spaces)

Put LDD in the subject line somewhere or it will get ignored.

Send on a small compiled app and sample source.

Subject: Basic Mode?

What do you mean by “basic mode”?

What about the “/basic” command line?

Subject: It does not happen in Basic mode

I searched and found out how to run LN 8.0.x in basic mode (thanks for the idea) and can confirm the code works.

So running in standard mode (which uses the JVM process notes2w.exe) causes some type of timing delay and dropping of keystrokes.

Subject: if you would say what problem you’re trying to solve…

there’s probably a better way to do it, which is not OS dependent.

Since you mention attachments, I thought this might help: How to use LotusScript to create a file attachment in the front end.

If the above does not solve your problem, we need more information about what you’re doing. If you’re not sure what information to supply, the C R I S P Y document might help you.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

Subject: Problem Description

Legacy code that works in LN 7 and earlier. This code uses keyboard synthesis to attach an existing file that is on the local client in a known temporary folder to the currently open newly created memo.

Testing this code in LN 8.0.x Standard edition does not work. Synthesized keys are dropped and the attachment operation fails.

I am not sure if the suggested approach to attaching existing files via an agent will work.

I believe the timing issue and the dropping of keys is a bug that I am hoping gets fixed.

Subject: Problem Description

The problem does not occur when running LN 8.0.x in basic mode. I suspect an issue related to the notes2w.exe (JVM) process.

Subject: Certainly the agent will work…

… and then you can solve the problem today, instead of waiting for a new release which may or may not fix it for you.

Subject: Impact of implementing an agent

If I choose to implement the solution as an agent then the agent needs to be installed in the mail database? Yes or no?

If yes, does this change the mail database template?

Subject: Where your code runs…

I see you reason the agent would have to be in the mail database. You could create a memo from any application, and operate on the uidoc (or create the document first and use EditDocument method.

Subject: Process used to send keys is Windows keybd_event

The code we use to simulate the keystrokes for attaching a local file used the Windows library function, keybd_event.

The logic is the same as described here: http://www-01.ibm.com/support/docview.wss?uid=swg21089151