WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sending Keystrokes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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, "~", "{~}")
pswd=StrReplace(pswd, "%%", "%%%%")
SendKey(pswd)

Article ID:   W14499
Filename:   Sending Keystrokes with Special Characters.txt
File Created: 2006:12:21:16:03:16
Last Updated: 2006:12:21:16:03:16