AppleScript and System Events "keystroke" function lead to incorrect casing when using uppercase letters
||Date Originated:||09 Nov 2016|
||Product Version:||macOS Sierra 10.12.2 Beta (16C41b)|
When using the "keystroke" function of System Events using AppleScript or from Objective-C with the ScriptingBridge framework, lowercase letters followed after an uppercase letter or symbol that requires the press of the shift key modifier appear as uppercase or mixed case.
This happens even though no modifier keys are pressed on the keyboard while executing the script. In fact no keys are pressed on the hardware keyboard at all.
Also, the actual output is different each time.
I've attached a sample script that illustrates the problem and a short video recording of my screen when the issue happens.
Steps to Reproduce:
1. Open Script Editor
2. Either open the attached sample script or paste this:
tell application "Terminal"
tell application "System Events" to keystroke "This is a test"
3. Watch the output in Terminal.app
The script should properly print each entered character in the correct casing.
The casing is different from what was entered and differs with each run.
macOS Sierra 10.12.2 Beta (16C41b)
Approximately every 10 runs the output is actually correct.
'Keystroke Test.scpt' and 'SystemEvents_Keystroke_Bug.mp4' were successfully uploaded.
Reports posted here will not necessarily be seen by Apple.
All problems should be submitted at bugreport.apple.com before they are posted here.
Please only post information for Radars that you have filed yourself, and please do
not include Apple confidential information in your posts. Thank you!