Mac AppleScript 自动登录两个QQ

作者: 十一岁的加重 | 来源:发表于2017-04-06 08:03 被阅读12630次

    反复实践,最终成果如下

    无图无真相

    qq.gif
    tell 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
    

    相关文章

      网友评论

      • 春田花花幼儿园: 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"
        加:keystroke return
      • James_Gong:行总就是这么犀利啊.
      • 十一岁的加重:至于为什么这么多delay 我也不知道,因为写了好久 也试了好久,
        如果不加上delay就没有效果也不会按下return键,真是奇怪了
        十一岁的加重:最近更新的版本,太完美了

      本文标题:Mac AppleScript 自动登录两个QQ

      本文链接:https://www.haomeiwen.com/subject/gtyfattx.html