请教一段关于用applescript 自动登录qq的脚本

2014-01-05 21:32:26 +08:00
 ri0day
自从新买的mac到了以后,最近都在熟悉mac os x ,发现applescript 很强大。于是网上看了一些例子,写了一个自动登录qq的脚本,但是发现输入密码的时候 按键输入到了错误的窗口中。
请大家看看什么问题

tell application "QQ"
activate

tell application "System Events"
tell application process "QQ"
keystroke "password"
keystroke return
end tell
end tell
end tell
4587 次点击
所在节点    macOS
1 条回复
ri0day
2014-01-06 21:40:32 +08:00
解决了:一定要把QQ这个应用设置到frontmost ,也就是focus到当前的app 窗口上

tell application "QQ" to activate
tell application "System Events" to set frontmost of process "QQ" to true
tell application "System Events"
keystroke "password"
keystroke return
end tell

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/95772

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX