1

Can someone please help me in fixing the issue that I am getting while passing (not a hyphen) through SendKeys in VBScript. Below is the code that I am trying:

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys"(%chr(0150))"

0150 is the ASCII value for .

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Sadique
  • 21
  • 4
  • 1
    The `–` is called "en dash" and is [Unicode character U+2013](https://www.fileformat.info/info/unicode/char/2013/index.htm), so you would normally specify it as `WshShell.SendKeys ChrW(&h2013)`. Unfortunately, while that works from VB6 and VBA, it does not work from VBScript because [`WScript.SendKeys` does not support Unicode](https://stackoverflow.com/a/23078578/11683). – GSerg Dec 17 '18 at 09:58
  • So how can I use this in VBScript? Or is there another way to use it? – Sadique Dec 17 '18 at 10:18
  • I need to use this code in UFT, so any help around that would be really appreciated. – Sadique Dec 17 '18 at 10:30
  • 1
    Possible duplicate of [Does or Can VBscript's SendKeys support Unicode?](https://stackoverflow.com/questions/3198574/does-or-can-vbscripts-sendkeys-support-unicode) – 41686d6564 stands w. Palestine Dec 17 '18 at 11:04
  • @Sadique Check the second answer in the duplicate question and see if that works for you. – 41686d6564 stands w. Palestine Dec 17 '18 at 11:04
  • @AhmedAbdelhameed Thanks for your response, but it is not working. – Sadique Dec 17 '18 at 16:19
  • sendKeys "{SUBTRACT}" may help you but I am not sure – ridvanzoro Jan 14 '19 at 08:32

1 Answers1

-1

I used ASCII character 45 and this worked

WshShell.SendKeys ChrW(45)
wscourge
  • 10,657
  • 14
  • 59
  • 80