What I want to do is
1. Take strings from the user and store it in a vector<string>
2. Loop through each string, typing each letter of the string
How would I go about doing this?
Robot r = new Robot();
char letter = 'a';
r.keyPress( (int) letter )
Won't work - since it wants a keycode
The following -almost- works;
It can type out a-z, A-Z, 0-9
but not åäö or !"# etc
How can I fix this/change the code so it can print out everything?
//Set vString_size
vString_size = vString.size();
//Start typing the given strings
for( int i=0; i<vString_size; i++ ) //Run through all the strings
{
//Set string_size
string_size = vString.get(i).length();
for( int j=0; j<string_size; j++ ) //Run through each letter
{
//Set letter
letter = vString.get(i).charAt(j);
//Get keycode
int keycode = KeyEvent.getExtendedKeyCodeForChar(letter);
r.keyPress ( keycode ); //Press key
r.keyRelease( keycode ); //Release key
}
//Press [ENTER]
r.keyPress( KeyEvent.VK_ENTER );
r.keyRelease( KeyEvent.VK_ENTER );
try
{
Thread.sleep(520);
}
catch(Exception exec)
{
exec.printStackTrace();
}
}