工具技巧AppleScriptMacOS开发 技术集锦

Mac AppleScript 自动登录两个QQ

2017-04-06  本文已影响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
上一篇下一篇

猜你喜欢

热点阅读