ChangWang Posted April 13, 2010 Posted April 13, 2010 The situation is, I am using AVT Fire Package to control a Camera. I am trying to automate the process of taking pictures at different shutter speeds. The problem I am experiencing is the option window, when open, has the same title as the main window. Not only this, but the title and handles change every time I open the program. The class however stays the same, I used the AutoIt window info tool to find this. I have been trying to use wintitlematchmode 4 to match the class, but it doesn't seem to work, either my syntax is wrong or something else is messing it up, but i have checked my syntax several times and it matches the examples. Does anyone know what is wrong or what I can do to make it work? Also, side note, my programing skill is not very strong, I have only been using AutoIt for a few weeks. I'll post the script that I have once I get my flash drive back from the lab, I left it there and I can't get back in without a professor. Thanks, Chang
MHz Posted April 13, 2010 Posted April 13, 2010 If your taking about an example like this from the help file, WinWaitActive("[TITLE:My Window; CLASS:My Class; INSTANCE:2]", "") then you are using the latest syntax. wintitlematchmode 4 exists as noted, "Kept for backward compatibility". So omit wintitlematchmode 4 as it maybe causing the failure. The old syntax never had the [] chars.
ChangWang Posted April 13, 2010 Author Posted April 13, 2010 If your taking about an example like this from the help file, WinWaitActive("[TITLE:My Window; CLASS:My Class; INSTANCE:2]", "") then you are using the latest syntax. wintitlematchmode 4 exists as noted, "Kept for backward compatibility". So omit wintitlematchmode 4 as it maybe causing the failure. The old syntax never had the [] chars. Will this work with a partial Title?
PsaltyDS Posted April 13, 2010 Posted April 13, 2010 Will this work with a partial Title?Try it and see! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ChangWang Posted April 13, 2010 Author Posted April 13, 2010 Alright, So partial Titles work, however, my problem still persists. Using the following line, I activate the main window no problem. WinActivate("[TITLE:Stingray F033B; CLASS:ATL:0051A5A8]","") However, when I try to activate the Option Box, with the following line, nothing seems to work. WinActivate("[TITLE:Stingray F033B; CLASS:#32770]","") Here are two screenshots of the windows. It seems that the blue bar at the top of the option window stays solid blue as though it is constantly selected regardless of which window is actually selected. I'm not sure what this means though. I'm using photobucket because I don't have photoshop to easily reduce the size of the image for attachment.
PsaltyDS Posted April 14, 2010 Posted April 14, 2010 Try listing the class first: WinActivate("[CLASS:#32770; TITLE:Stingray F033B]","") I'm on an Ubuntu laptop with no Windows VM to test right now, but I think if it only finds one top-level instance matching the first parameter, it doesn't check the second. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ChangWang Posted April 14, 2010 Author Posted April 14, 2010 So after talking to some CS majors, I think I know what the problem is, but I'm not sure how useful this information will be. It seems that what happens is that when the option box opens, it is the same thing as the parent but it has a different thread ID. When I try to activate one window, it will only activate the parent window, not the option window (they both have the same process ID). This is a problem because in order for me to tell the difference between the two windows, I will need to get the thread ID which can only be found at the creation of the child window. The way I'm supposedly supposed to solve this probem is to acquire the thread ID upon creation of the window and then use that to identify the windows. The other work around is something (or so I am told) simpler, but more time consuming and requires editing of the source code (which I don't have).
MHz Posted April 14, 2010 Posted April 14, 2010 Or another option is using Opt('WinSearchChildren', True) Option | Param WinSearchChildren | Allows the window search routines to search child windows as well as top-level windows. 0 = Only search top-level windows (default) 1 = Search top-level and child windows
PsaltyDS Posted April 14, 2010 Posted April 14, 2010 So after talking to some CS majors, ...As they say on Myth Busters: "Well, THERE'S your problem!" Did you try MHz's or my earlier suggestions? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 If worse comes to worse, I think that bloating the script might work... If the child window is always the same size and is not the same size as the parent, then you can probably do what you want by finding the handle. You could do a wingetlist to get a list of all windows, then do a wingetpos on windows with a matching title, then compare the window size of the found matching windows with the size the child window should be. When you have a match, you will know which handle returned by wingetlist to use. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
ChangWang Posted April 15, 2010 Author Posted April 15, 2010 Or another option is using Opt('WinSearchChildren', True) I'll give this a try once I get back to the lab. It looks promising. As they say on Myth Busters: "Well, THERE'S your problem!" Did you try MHz's or my earlier suggestions? I did try the WinActivate("[CLASS:#32770; TITLE:Stingray F033B]","") but it didn't work out. If worse comes to worse, I think that bloating the script might work... If the child window is always the same size and is not the same size as the parent, then you can probably do what you want by finding the handle. You could do a wingetlist to get a list of all windows, then do a wingetpos on windows with a matching title, then compare the window size of the found matching windows with the size the child window should be. When you have a match, you will know which handle returned by wingetlist to use. I like the sound of the size of the box thing. I'll also give this a go once I get back to the lab.
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