SendKeys Operating System Limitations

870 Views Asked by At

Are there Operating System related intricacies with the SendKeys vbScript method? I am upgrading from a GE Cimplicity 4 project on a Windows XP computer to GE Cimplicity 10 project on a Windows Server 2012 R2 Virtual Machine.

The SendKeys method was used to change tab focus on a screen opening. The script now indefinitely freezes no matter what key is sent using SendKeys. Has anyone encountered any SendKeys freezes after Operating System changes before?

SendKeys “{TAB}”, 1

Documentation I have referenced so far:

http://proscada.ru/cimplicity/bce-lrf/lrfs/sendkeys.statement.htm

https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx

2

There are 2 best solutions below

0
On BEST ANSWER

The issue was narrowed down to a newer Microsoft Security feature called "User Access Control (UAC)" that started with Windows Vista. The feature needs to be turned off in order to get the sendKeys command to work properly with Cimplicity.

As for sendKeys performance outside of Cimplicity, sendKeys has a few different implementations depending on timing and Operating System. To force sendKeys to use only one implementation to get consistent timing (if consistency is an issue), you can update the app.config file to force an implementation by adding:

<appSettings>
    <add key="SendKeys" value="SendInput"/>
</appSettings>

Reference:

https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send(v=vs.110).aspx

4
On
 SendKeys "{TAB}1"

Strings (ie text) must be enclosed in quotes.