Applescript击键可以使一些角色大写

时间:2017-01-03 17:05:43

标签: bash macos applescript zsh osascript

127  ;-(Tue Jan 03 22:27:09 Mac mini  ~
$   echo 'tell application "System Events" to keystroke "Changeme@123"'|osascript
CHAN

0  :-)Tue Jan 03 22:27:17 Mac mini  ~
$  CHANgeme@123

$  zsh
Mac mini% echo 'tell application "System Events" to keystroke "Changeme@123"'|osascript

CHa%
Mac mini% CHaNgeme@123

知道是什么导致某些字母被大写?如果第一个字符是大写的话,这似乎就会发生。

1 个答案:

答案 0 :(得分:0)

不确定原因,但如果你想要一个临时的解决办法,这是有效的:

#!/bin/bash
osascript <<EOF
tell application "System Events" to keystroke "C"
tell application "System Events" to keystroke "h"
tell application "System Events" to keystroke "a"
tell application "System Events" to keystroke "n"
tell application "System Events" to keystroke "g"
tell application "System Events" to keystroke "e"
tell application "System Events" to keystroke "M"
tell application "System Events" to keystroke "e"
tell application "System Events" to keystroke "@"
tell application "System Events" to keystroke "1"
tell application "System Events" to keystroke "2"
tell application "System Events" to keystroke "3"
EOF