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 ()
原文地址:https://www.cnblogs.com/gaitian00/p/2921802.html