1

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

Andrew Drake
  • 655
  • 1
  • 11
  • 25

2 Answers2

0
 SendKeys "{TAB}1"

Strings (ie text) must be enclosed in quotes.

acatatwork
  • 21
  • 1
  • You’re right, that was a typo in my original post. I do have the quotes and it compiles. Works in XP but not Server 2012 R2 – Andrew Drake Feb 19 '18 at 01:47
  • You cannot sendkeys to processes with different security. This came in after XP. See https://en.wikipedia.org/wiki/User_Interface_Privilege_Isolation – acatatwork Feb 19 '18 at 02:40
  • Your syntax is specific to VBA 7. There is no wait in VBA6/VBScript/VB.NET. So only `SendKeys "{TAB}"`. – acatatwork Feb 19 '18 at 04:33
  • The NoWait is optional, I have tried both with and without it (without it defaults to 0). Both still freezes in Windows Server 2012 R2 but not XP. Again, this is not a syntax question, but rather why SendKeys has performance issues depending on the operating system. – Andrew Drake Feb 19 '18 at 13:48
0

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

Andrew Drake
  • 655
  • 1
  • 11
  • 25