Edmonds Posted October 26, 2012 Share Posted October 26, 2012 I am trying to automate a program that uses a file openning window that has what appears to be a ComboBox that allows users to select a location in which to search for candidate files. I need to set this to "My Network Places". However, when I try to use the set_dropdown function to control it, the best I'm able to do is temporarily select the item. The box returns to the default selection before I'm able to do anything else. From visual inspection, I can see that the contents of the ComboBox are not an ordinary text list, but appear to be a TreeView control, so I'm actually surprised that set_dropdown was able even to temporaily set the value. Is there anything that can be done to control a TreeView that appears within a ComboBox? RE Link to comment Share on other sites More sharing options...
Mechaflash Posted October 26, 2012 Share Posted October 26, 2012 Can you give the section of script used to manipulate the control? I've dealt with this before. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Edmonds Posted October 26, 2012 Author Share Posted October 26, 2012 I finally remembered that the function "set_dropdown" I was using was created by a third party, but its active ingredient is this line: ControlCommand($win, "", $ctrlID, "SelectString", $select_string) where $win= "Open", $ctrlID = "ComboBox1" and $select_string="My Network Places". You see the selection in the text box go to "My Network Places" for a short time. The following statement is: $ctrl_txt = ControlGetText($win, "", $ctrlID) Perhaps that has something to do with triggering it to revert to the initial text. RE Link to comment Share on other sites More sharing options...
Edmonds Posted October 26, 2012 Author Share Posted October 26, 2012 I finally remembered that the function "set_dropdown" I was using was created by a third party, but its active ingredient is this line:ControlCommand($win, "", $ctrlID, "SelectString", $select_string)where $win= "Open", $ctrlID = "ComboBox1" and $select_string="My Network Places". You see the selection in the text box go to "My Network Places" for a short time. The following statement is:$ctrl_txt = ControlGetText($win, "", $ctrlID)Perhaps that has something to do with triggering it to revert to the initial text.REI finally was able to get on to the machine I was using yesterday, and that was slightly inaccurate. I was only able to get to "Desktop" (select_string = "Desktop"), but it would remain set until I issued the next command. Just now I discovered that it appears that issuing two control_click commands makes the "Desktop" selection stick and brings up a menu, which seems to be a conventional listview, from which I probably can select "My Network Places". I'm still very interested in how you did it, I suspect you did it the "right" way.RE Link to comment Share on other sites More sharing options...
Mechaflash Posted October 29, 2012 Share Posted October 29, 2012 There's a couple of finicky things to recognize with these Combo Boxes.1. In order to cycle through multiple items, (i.e. sending a ControlCommand($title, "", "cID", "SelectString",$s) to multiple items), it will only work if you force a "ShowDropdown" first.2. For it to show the contents of the selected folder, you have to perform a ControlSend() with the "{ENTER}" key.3. It will only allow you to send the "{ENTER}" key to show the contents of the selected folder if the combobox is in a 'dropped down' state.4. [EXTRA] Some applications (like Notepad and OpenOffice) show the [CLASS] of the dropdown box as being #32770, where ClassNN = #327701, when it is actually ComboBox, where ClassNN = ComboBox1, like all the others. With that being said, I tested this on the Firefox 'Open File' dialogue. The below reproduces the issue.$sTitle = "Open" $sID = "ComboBox1" WinActivate($sTitle) ControlCommand($sTitle, "", $sID, "ShowDropdown", "") Sleep(1000) ControlCommand($sTitle, "", $sID, "SelectString", "My Network Places") Sleep(1000) ControlSend($sTitle, "", $sID, "{ENTER}")SOLUTION:The below code will allow you to do what you need (tested using the Firefox 'Open File' dialogue.$sTitle = "Open" $sID = "ComboBox1" WinActivate($sTitle) ControlCommand($sTitle, "", $sID, "ShowDropdown", "") Sleep(1000) ControlCommand($sTitle, "", $sID, "SelectString", "My Network Places") Sleep(1000) ControlCommand($sTitle, "", $sID, "ShowDropdown", "") ; <<<<<<<<<<<<<<<<<<<<< Added Sleep(1000) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Added ControlSend($sTitle, "", $sID, "{ENTER}") Edmonds 1 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Edmonds Posted November 19, 2012 Author Share Posted November 19, 2012 Oh, I never noticed that response! I managed to kludge it, but I will try this to see if it can be done the right way. Hopefully I can replace it with this in the next version. Thank you so much! RE 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