Page 1 of 1

SendKeys

PostPosted: Sat Nov 06, 2004 9:34 am
by Guest
SendKeys "filename.exe" "{AltDn}A{AltUp}" sends command Alt+A to filename.exe, but what if I want to send the actual characters "{AltDn}..."? The answer, while not obvious, is easy to implement—replace each "{" with "{{ " = "{{[#32]" = leftbrace leftbrace space. This replacement is straightforward with NeoBook's StrReplace command.

Code: Select all
SetVar "[commands]" "{AltDn}A{AltUp}"
StrReplace "[commands]" "{" "{{[#32]" "[commands.converted]"
SendKeys "filename.exe" "[commands.converted]"

The filename.exe program receives the 15 characters "{AltDn}A{AltUp}" instead of the single command Alt+A.