callagga Posted August 25, 2009 Share Posted August 25, 2009 Hi, Just starting out. It would be great if someone could help me out re clarifying the following. The questions relate to use of ControlSend & Send. BACKGROUND: * I have an application I'm working with that can have more than one window (non-modal) open at a time. It seems the CLASS names are the same here. * I also note there are lots of windows for that application that have this CLASS name but for which they are Hidden (which is probably one aspect of the problem I've been having) Q1 - If I'm using ControlSend then is it true that the TITLE parameter (e.g. [CLASS:windowX; TITLE:titleY]) is the only means of ensuring you narrow the scope down to the window you want for the application? So in this case the TITLE has to be unique across all the running instances of windows for the application (i.e. whether hidden or not)? Q2 - That is, the controlID can't be used as the deciding factor in ControlSend can it? That if there were two windows with the same class & title, but only one of them had controlID X, then would that match this one? Q3 - What happens where using ControlSend when there are multiple windows that match? Does the first one win? Q4 - What's the best way to ensure you're targeting your Send/ControlSend etc to the correct window/control in general? Is it best to do a some detailed search, verification and then grab the windows handle? Q5 - What's the best way to verify a window you close has closed? Noting I run into the issue in this application that it still seems to retain (in a HIDDEN) state the window (i.e. same CLASS/TITLE) around. thanks Link to comment Share on other sites More sharing options...
Firstone Posted August 25, 2009 Share Posted August 25, 2009 Most of your questions can be solved by using handles I would find the handle of each application, since each window will have a unique handle. I'm doing a similar thing atm. I want to controlclick on different IE windows, and they have the same title. This is why I had to use handles. Link to comment Share on other sites More sharing options...
will never learn Posted August 25, 2009 Share Posted August 25, 2009 to get the handel of a window, try something like this (depending on what you want to do). Dim $handle $handle = FileOpen(yourprogram) As far as I know ControlIDs are unique. Even if you open a window, close it and open it again. The control handles for the different windows remain the same. Just try this out a bit to get a feel for it. Use the AutoIt Window Info tool to get the Control-IDs. Link to comment Share on other sites More sharing options...
callagga Posted August 25, 2009 Author Share Posted August 25, 2009 Thanks I guess specifically can I ask: a) if I send a control-s to a window that triggers a save/close for that app, how can I check this worked? The window itself seems to be retained by the application as not visible. to be sure that things are ready for you to send characters, but also want to minimise script delays which funtions should I use? Eg Winwaitactive() followed by Controlgetfocus() check 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