反复实践,最终成果如下
无图无真相
qq.giftell application "QQ"
activate
tell application "System Events"
tell application process "QQ"
activate
delay 1
set frontmost to true
--get entire contents of window 1
set value of text field 1 of window "Window" of application process "QQ" of application "System Events" to "QQ1号码"
set value of text field 2 of window "Window" of application process "QQ" of application "System Events" to "QQ1密码"
click checkbox 3 of window "Window" of application process "QQ" of application "System Events"
delay 1
-- command n 再新建一个QQ
keystroke "n" using command down
set frontmost to true
-- command tab 把准备用于登录第二个QQ的窗口放前面来
keystroke tab using {command down}
delay 1
key code {48, 51}
keystroke "QQ2号码"
--delay 1
keystroke return
delay 1
keystroke "QQ2密码"
delay 1
keystroke return
end tell
end tell
end tell
网友评论
delay 1
set frontmost to true
--get entire contents of window 1
set value of text field 1 of window "Window" of application process "QQ" of application "System Events" to "QQ1号码"
set value of text field 2 of window "Window" of application process "QQ" of application "System Events" to "QQ1密码"
click checkbox 3 of window "Window" of application process "QQ" of application "System Events"
加:keystroke return
如果不加上delay就没有效果也不会按下return键,真是奇怪了