Mucho Posted May 12, 2009 Share Posted May 12, 2009 Attached is a screenshot of my example. I may have several charts on my Metastock program that I want to close. A confirmation box will pop up to ask me to confirm if I want to close each chart even though I want to close all. See attachment. The text inside the box varies according to the layout numbers: "Save changes to Layout5?" can be changed to "Save changes to Layout46?". My code below works only in closing once. It does not seem to find the next confirmation box. CODEOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",2) Opt("WinSearchChildren", 1) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Opt("WinTextMatchMode", 2) #Include <WinAPI.au3> WinWait("MetaStock Professional", "Save changes to Layo", 1) Do $hWin = WinGetHandle("MetaStock Professional", "Save changes to Layo") _WinAPI_SetFocus($hWin) WinActivate($hWin) WinWaitActive($hWin,1) Send("!n") Until WinExists("MetaStock Professional", "Save changes to Layo") = 0 Can someone help with a proper code? Link to comment Share on other sites More sharing options...
exodius Posted May 12, 2009 Share Posted May 12, 2009 Do some of the confirmation boxes actually have the title "MetaStock Professional"? Your example image only shows "MetaStock"... Link to comment Share on other sites More sharing options...
system24 Posted May 12, 2009 Share Posted May 12, 2009 While 1 $hWin = WinGetHandle("MetaStock", "Save changes to Layo") If @error = 1 Then ExitLoop Else WinActivate($hWin) Send("!n") EndIf WEnd [center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center] Link to comment Share on other sites More sharing options...
Mucho Posted May 12, 2009 Author Share Posted May 12, 2009 System26, It still closes only one box with your code. I am wondering whether the Mcafee Antivirus is interfering. Thomas While 1 $hWin = WinGetHandle("MetaStock", "Save changes to Layo") If @error = 1 Then ExitLoop Else WinActivate($hWin) Send("!n") EndIf WEnd Link to comment Share on other sites More sharing options...
Mucho Posted May 12, 2009 Author Share Posted May 12, 2009 (edited) EXODIUS,You're right. I GOOFED. And it's working now. Thank you and thank you to System24 too.ThomasDo some of the confirmation boxes actually have the title "MetaStock Professional"? Your example image only shows "MetaStock"... Edited May 12, 2009 by Mucho Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now