本文共 1115 字,大约阅读时间需要 3 分钟。
利用AccExplorer.exe来打开选定的窗口
$Dis_Window_title:窗口名
Func Select_window_Dialog($Dis_Window_title)
;select one window in AccExplorer WinActivate($Dis_Window_title) ;判断当前AccExplorer是否已运行,如果在运行,则停止该程序 While ProcessExists("AccExplorer.exe") ProcessClose("AccExplorer.exe") WEnd Sleep(10) ;运行AccExplorer程序,并最大化Run("AccExplorer.exe","",@SW_MAXIMIZE)
;如果出现错误,则关闭AccExplorer,等待一段时间后再重新打开该程序
While @error If ProcessExists("AccExplorer.exe")Then ProcessClose("AccExplorer.exe") EndIf Sleep(500) Run($AccPath & "AccExplorer.exe","",@SW_MAXIMIZE)WEnd
;如果一定时间内没有启动AccExplorer程序,则把信息写入log中
If not WinWaitActive($AccExplorerWindow,"",10)Then ;_FileWriteLog($LogPath & "\" & $LogName, "{Open the AccExplorer.exe timeout.} " & "[Error]", -1) Return 0EndIf
;此时保证AccExplorer已经运行,并最大化,然后通过其菜单,打开选择窗口
Sleep(800) Send("!o") ;打开菜单项Options Sleep(800) Send("c") ;选择choose window from list Sleep(800) Send($Dis_Window_title) ;输入要打开的window Sleep(5000) Send("{Enter}") ;按回车键 Sleep(8000) ;While Not StringInStr(ControlGetText ($AccExplorerWindow,"",$StatusBar),"Built hierarchy") ;WEnd ;展开该窗口列表 Sleep(5000) Send("+x") Sleep(5000) Return 1 EndFunc转载地址:http://lkjci.baihongyu.com/