max 处理界面自动化处理(转载)

fn AutoPressOK flag:true = ( 
        if flag then (
                DialogMonitorOPS.unRegisterNotification id:#autoPressYes
                fn autoPressOK = (
                        WindowHandle = DialogMonitorOPS.GetWindowHandle()
                        if UIAccessor.GetWindowText WindowHandle == "File Exists" do (
                                skinBoneCtrls = UIAccessor.GetChildWindows WindowHandle 
                                for hand in skinBoneCtrls where UIAccessor.GetWindowText hand == "Yes" do UIAccessor.PressButton hand 
                        )
                        true
                )
                DialogMonitorOPS.RegisterNotification autoPressOK id:#autoPressYes
                DialogMonitorOPS.Enabled = true
                --DialogMonitorOPS.ShowNotification()
        )
        else(
                DialogMonitorOPS.unRegisterNotification id:#autoPressYes --不应该将其简单的注销,否则所有窗口都将显示不正常
                DialogMonitorOPS.Enabled = false                             --一定要关闭窗口自动操作
        )
)
AutoPressOK ()

 

posted on 2013-02-22 10:11  盖天00  阅读(298)  评论(0编辑  收藏  举报

导航