; This must be run with Beta 3.2.13.1 or later to have _GuiCtrlTab_ClickTab()
#include <GuiTab.au3>

; Open system properties
Dim $sTitle = "System Properties" 
Send("#{Pause}") 
WinWait($sTitle, "", 10)
$hWnd = WinGetHandle($sTitle)
If @error Then _Exitonerror("Failed to open System Properties window.")
WinActivate($hWnd)
Sleep(2000)

; Get handle to Tab control
$hTab = ControlGetHandle($hWnd, "", "SysTabControl321")
If @error Then _Exitonerror("Failed to get handle to TAB control.")

; Find and select Advanced tab
$iAdvTab = _GUICtrlTab_FindTab($hTab, "Advanced")
If $iAdvTab = -1 Then _Exitonerror("Failed to find 'Advanced' tab.")
_GUICtrlTab_ClickTab($hTab, $iAdvTab)
If _GUICtrlTab_GetCurSel($hTab) <> $iAdvTab Then _Exitonerror("Failed to change selected tab to 'Advanced'.")
Sleep(2000)

; Click on Error Reporting button
ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:8]"); Error Reporting

; Wait for Error Reporting dialog and click 'Cancel'
WinWait("Error Reporting", "", 10)
Sleep(2000)
ControlClick("Error Reporting", "", "[CLASS:Button; INSTANCE:8]"); CANCEL
Sleep(2000)

; Close System Properties
WinClose($hWnd)


Func _Exitonerror($sText)
    MsgBox(16, "Error", $sText)
    Exit
EndFunc
posted on 2014-07-16 15:50  Jessica Lu  阅读(1355)  评论(0)    收藏  举报