美文网首页
AutoIt3示例

AutoIt3示例

作者: MicoCube | 来源:发表于2020-11-09 12:57 被阅读0次
    $chrome_path = "C:\Users\MicoCube\AppData\Local\Google\Chrome\Application\chrome.exe"
    
    ;;打开窗口
    Local $val = Run($chrome_path,"",@SW_SHOWMAXIMIZED)
    ;;登录窗口显示
    WinWaitActive("[CLASS:Chrome_WidgetWin_1]")
    ;; 休息2000毫秒
    Sleep(2000)
    ;; 移动窗口
    ;;WinMove("[CLASS:Chrome_WidgetWin_1]", "打开新的标签页 - Google Chrome", 0, 0,1200,740,2);
    ;; 休息500毫秒
    Sleep(500)
    ;; 窗口PID
    ;;MsgBox(0, "PID:", $val);
    
    ;;清除cookie
    Send("chrome://settings/clearBrowserData");
    send("{enter}");
    Sleep(2000)
    MouseClick("left",837,645,2);
    ;;
    Sleep(2000)
    
    ;;打开浏览页面
    Send("^t");
    Sleep(500)
    Send("https://www.baidu.com");
    Send("{enter}");
    Sleep(2000)
    
    
    
    MouseClick("left",473,286,1);
    Send("java");
    Send("{enter}");
    Sleep(2000)
    
    ;;判断窗口是否存在
    If WinExists("[CLASS:Chrome_WidgetWin_1]") Then
        MsgBox(0, "info", "窗口存在")
    Else
        MsgBox(64, "error", "窗口不存在")
     EndIf
    
    MsgBox(0, "PID:", $val);
    ProcessClose($val)
    MsgBox(0, "已关闭:", $val);
    
    • 获取cmd返回值
    #include <Constants.au3>
    
    Local $p = Run(@ComSpec & " /c ping 6san.com","",@SW_HIDE, 15)
    Local $line
    ProcessWaitClose($p)
    While 1
    $line = StdoutRead($p)
    If @error Then ExitLoop
    MsgBox(0,"STDOUT read:", $line)
    Wend
    

    相关文章

      网友评论

          本文标题:AutoIt3示例

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