Wednesday, April 09, 2008

question about using SendKeys in Notes

I've been working on something lately and I needed to use SendKeys from a button in a Notes document. I kept getting the error "Illegal function call". I finally found someone with the same problem on, and when I used WScript.Shell it worked perfectly.

The help for SendKeys says "The SendKeys statement is not legal at the module level." Could someone translate that into English for me? How is code in a button click event "at the module level"? If that's at the module level, what isn't?


  1. Isn't this just referring to the fact that there is no SendKeys implementation in Lotusscript (despite the fact that the function is listed in its lexicon) -- hence the need for WScript?

    Or am I being dim?

  2. Nah hes used it before

  3. Ben, I'm not sure I follow you. If there is no SendKeys implementation in Lotusscript why is it in Designer help at all? It even gives an example of using it. I have a solution to my specific problem, now I'm trying to figure out in what case the LotusScript SendKeys will ever work. I haven't found any yet.

  4. @Charles, because there was a SendKeys implementation in VIP and Improv, where Lotusscript got its start. And it's still there in the SmartSuite support. And it's useful if you're making COM calls.

    But it's the second sentence in the help...

    "SendKeys is not supported on Macintosh and UNIX platforms and is not supported in Lotus Domino and Notes."

    before you ask, yes, it's monumentally stupid that it's documented. But there is some logic to the fact that it doesn't work.

  5. @Charles / Wombat: what Nathan said. See, I wasn't being dim! (there's a first). It is weird how it's there and unusable, but there is a reason for it.

  6. Well color me clueless! Thanks for being my eyes, Nathan. I completely missed the bit about it not being supported in Notes or Domino. :-)

    Any idea what we can use for doing this cross-platform?

  7. This comment has been removed by the author.

  8. Cross platform SendKeys? Are you insane?

    Closest I've heard is Java, but it might not work right everywhere:

    Just stick with Windows old buddy.