skoota Posted March 27, 2008 Share Posted March 27, 2008 Hello All, I am a new user to AutoIt, and need to design a script which will open the Windows XP Device Manager, expand the "Mice and other pointing devices" device type (in the tree view), and open the properties for a device titled "USB Human Interface Device". I am able to open the Device Manager using the following code: ; Open the Device Manager Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE) ; Wait for Device Manager window to become active WinWaitActive("Device Manager") However, after this point I am stuck. Using AutoIt Window Info, it seems that the Device Manager tree view is a SysTreeView control and does not have a control id (see the screen shot below). So, I am unsure how I can control this SysTreeView? If anyone has any suggestions on how to control the SysTreeView, and open the properties of the "Mice and other pointing devices" > "USB Human Interface Device" I would greatly appreciate your suggestions. Thanks, Matt Link to comment Share on other sites More sharing options...
ResNullius Posted March 27, 2008 Share Posted March 27, 2008 (edited) In XP, once the device manager is open, send a "{TAB}" to highlight the first item on the list then send "mice" and that will take you to the "mice and other pointing devices". Send the numeric keypad "+" sign and that will expand the branch. Use the same techniques to move to "USB Human Interface Device" I haven't looked, but I'm sure this would also be scriptable using the some of the listview specific functions. What do you want to once you get there? Change a setting? View the information? Delete an item? Edited March 27, 2008 by ResNullius Link to comment Share on other sites More sharing options...
Siao Posted March 27, 2008 Share Posted March 27, 2008 #Include <GuiTreeView.au3> ShellExecute('devmgmt.msc') WinWaitActive("Device Manager") $hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]") $hItem = _GUICtrlTreeView_FindItem($hTree, "USB Human Interface Device") _GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET) ; Focus treeview and Send Enter ControlFocus("Device Manager", "", $hTree) ControlSend("Device Manager", "", $hTree, "{ENTER}") Exit "be smart, drink your wine" Link to comment Share on other sites More sharing options...
weaponx Posted March 27, 2008 Share Posted March 27, 2008 Devcon is your friend Link to comment Share on other sites More sharing options...
skoota Posted March 29, 2008 Author Share Posted March 29, 2008 I would first like to thank everyone who provided feedback. In particular, thanks to Siao to the fantastic segment of code which accomplished exactly what I needed. I have now encountered another issue. I am attempting to automate the installation of a Bluetooth device (mobile phone). I have gotten AutoIt to automate up until the window where you need to select the device to add. The devices are being displayed within a SysListView32, in a graphical format rather than pure list (see the screen shot below), and I can't figure out how to select the device by name from the list. It is essential that the device is selected by name, as other computers may have multiple Bluetooth devices listed (rather than just one) so I can't simply say select the first device in the list. So, in a nutshell, I need AutoIt to select the "K800i" device by name, and click the "Next" button (which becomes enabled once the device is selected). Any help would be greatly appreciated. Thanks, Matt Link to comment Share on other sites More sharing options...
skoota Posted March 29, 2008 Author Share Posted March 29, 2008 Hi All, Don't worry, figured this one out myself. This can be done with the following code: ; Find K800i Device $deviceIndex = ControlListView("Add Bluetooth Device Wizard", "", 1031, "FindItem", "K800i") ; Select K800i Device ControlListView("Add Bluetooth Device Wizard", "", 1031, "Select", $deviceIndex) ; Click NEXT button ;send("!n") Link to comment Share on other sites More sharing options...
Lakers24 Posted May 4, 2010 Share Posted May 4, 2010 Devcon is your friendYou are the Man!!!, this is something I've been looking for.The AutoIT community ROCKS, you guy (and gals) are always so much help. 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