Mac AppleScript 自动登录3个QQ

更新,最近又得登3个QQ了,修改了代码,更快了一些,主要之前用的delay 1,现在升级为keystroe tab,不用等待,输入完账号或者密码时,按tab,就是来切换到,账号输入框按tab到密码输入框按tab到登录按钮


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账号"
            keystroke tab
            set value of text field 2 of window "Window" of application process "QQ" of application "System Events" to "QQ1密码"
            keystroke tab
            click checkbox 3 of window "Window" of application process "QQ" of application "System Events"
            keystroke return
            
            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账号"
            keystroke tab
            keystroke "QQ2密码"
            keystroke tab
            keystroke return
            
            
            
            -- 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 "QQ3账号"
            keystroke tab
            
            keystroke "QQ3密码"
            keystroke tab
            
            keystroke return
            
        end tell
    end tell
end tell


反复实践,最终成果如下

无图无真相

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 第五项修炼,彼得·圣 (新世纪最新扩充修订版) 2009中文序 领导人就是占据权位而自动出现的;必须拥抱领导的“...
    际弋阅读 9,333评论 1 38
  • 重看了《阿凡达》,对电影中出现过好几次的一句台词“I see you”印象很深。其中一幕,杰克•萨利阿凡达和涅提妮...
    蜗牛的阶梯阅读 5,115评论 2 3
  • 想玩耍的却顾虑早起,或者后悔那么早起床,张同学啊张同学哪能有这种心态,出去玩当然会累一些,做什么事都是要付出的嘛怪...
    于小喜阅读 1,014评论 0 0
  • 前几日,心情烦躁,乌云一直徘徊头顶。科三挂、又面临学生会的事(许多的新闻稿要写、官网需要更新、学生会换届也要推迟,...
    夏未初1997阅读 6,912评论 0 1
  • 老了我就开个花茶店,放很多书在店里,让每个来喝茶的人都能找到适合自己读的书,栽许多花,喝着花茶也能闻到芬芳花香!店...
    烙野门阅读 2,312评论 0 0