Jump to content
Sign in to follow this  
leonidnei

How to send a character independently on input locale?

Recommended Posts

leonidnei

I expected

send("a")

to send letter 'a', but it sends a keystroke which depends on input locale, so if the current locale is not English, the result can be different.

send("{ASC 097}") always sends 'a'.

Obviously it is not practical to send text in hex format, so is there a way to send text which will be the same with any input locale?

Share this post


Link to post
Share on other sites
FreeFry

Actually, it's not hex, it's decimal ascii code, and i guess you could do something like this.

Dim $Sentence = "Test sentence"

For $i = 1 To StringLen($Sentence)
    
    $char = StringLeft($Sentence, 1)
    $Sentence = StringTrimLeft($Sentence, 1)
    
    Send("{ASC " & Asc($char) & "}")
    
Next
Edited by FreeFry

Share this post


Link to post
Share on other sites
leonidnei

Probably this will work, but it looks so ugly!

I cannot believe there is no way to send plain text just as Wscript SendKeys does (http://www.devguru.com/Technologies/wsh/quickref/wshshell_SendKeys.html)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×