osascript keystroke character case with VMware web console
1
vote
0
answers
75
views
Looking to get the ability to simulating typing a password into a vm console. Figured osascript and keystroke should be the answer.
If I run the following I get what I believe to be the correct behaviour in the terminal.
The context is successfully switched to the Safari vm console window and the string is written correctly except all characters are lower case. The
#!/usr/bin/osascript
set UC to "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ"
set lc to "abcdefghijklmnopqrstuvwxyzåäö"
#tell application "Safari" to activate
tell application "System Events"
repeat with c in (the clipboard)
considering case
if UC contains c then
key down shift
keystroke "u" #c
key up shift
else
keystroke "l" #c
end if
end considering
end repeat
end tell
Result with stackEXCHANGE
in clipboard:
➜ ~ ./send_keys.osa
lllllUUUUUUUU% ➜ ➜ ~ lllllUUUUUUUU
Adding the tell to activate Safari I expect something similar to end up in my VMware vm console terminal - however:

key down shift
and key up switch
which work fine in terminal (or in other web sites I tested), does **not** work in the vm console.
How can I get keystroke to send characters in the correct case to the vm console? (Or - is there another way to get the string into the vm console?)
Asked by azzid
(213 rep)
Nov 17, 2023, 01:24 PM
Last activity: Nov 17, 2023, 02:23 PM
Last activity: Nov 17, 2023, 02:23 PM