Skip to main content

Using SendKeys for control keys

  • May 25, 2017
  • 2 replies
  • 0 views

We have a lot of legacy EXTRA Basic code that uses the SendKeys method to send control keys to the screen. For example:

SendKeys("<PF3>")
SendKeys("SomeValue<ENTER><PF9>")
SendKeys("<CLEAR>")



In the Reflection API, it appears that the SendKeys method simply passes the literal string to the screen rather than executing the control key. Is there any way to make this work similar to EXTRA Basic, or do we just have to update our code to use the new SendControlKey method?


#Desktop
#Reflection

2 replies

We have a lot of legacy EXTRA Basic code that uses the SendKeys method to send control keys to the screen. For example:

SendKeys("<PF3>")
SendKeys("SomeValue<ENTER><PF9>")
SendKeys("<CLEAR>")



In the Reflection API, it appears that the SendKeys method simply passes the literal string to the screen rather than executing the control key. Is there any way to make this work similar to EXTRA Basic, or do we just have to update our code to use the new SendControlKey method?


#Desktop
#Reflection
If you are converting code to use the Reflection API, you will need to use the separate "SendControlKey" method to send enter and other "AID" keys. In the previous versions of Reflection (14.1 and earlier), these were also separate functions ("Transmit" and "TransmitTerminalKey"), and the new version of the Reflection API is consistent with the old version of Reflection, not Extra!.

Your old Extra! Basic code should still work as-is with Reflection, since backwards-compatibility for this is provided by Reflection Desktop. So you shouldn't need to update anything unless you want to change something. Of course, new macros or other scripts should use the new Reflection API, which provides extensive control over all aspects of the product.

If you are converting code to use the Reflection API, you will need to use the separate "SendControlKey" method to send enter and other "AID" keys. In the previous versions of Reflection (14.1 and earlier), these were also separate functions ("Transmit" and "TransmitTerminalKey"), and the new version of the Reflection API is consistent with the old version of Reflection, not Extra!.

Your old Extra! Basic code should still work as-is with Reflection, since backwards-compatibility for this is provided by Reflection Desktop. So you shouldn't need to update anything unless you want to change something. Of course, new macros or other scripts should use the new Reflection API, which provides extensive control over all aspects of the product.
Thanks, that's what I suspected. I forgot to mention that this is .NET code, where the backwards compatibility doesn't seem to work as well.