How to Send Keystrokes with Special Characters
Keywords: sendkeys special characters
Question:
I would like to prompt a user for password and send it as keystrokes to another program. The problem I have is if the
password contains special charecters (e.g. !&^@....) winbatch fails to send the key strokes properly (because it requires
Shift + or the key be enclosed in {}). How would I address this problem.
Answer:
Something like:
pswd=AskPassword(...
pswd=StrReplace(pswd, "{", "{{}")
pswd=StrReplace(pswd, "+", "{+}")
pswd=StrReplace(pswd, "!", "{!}")
pswd=StrReplace(pswd, "^", "{^}")
pswd=StrReplace(pswd, "~", "{~}")
SendKey(pswd)
Article ID: W14499
Filename: Sending Keystrokes with Special Characters.txt