Jump to content

Recommended Posts

Posted (edited)

Hi All , 

I want to automate driver installation using device manager . I am able to get device manager windows pop up but i am not able to  select root tree item .

Please let me know  i am missing something given below code 

#Include <GuiTreeView.au3>

ShellExecute('devmgmt.msc')
WinWaitActive("Device Manager")
Global $hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]")
MsgBox(0, "ControlGetHandle Example", "The control handle of Edit1 is: " & $hTree)
$hItem = _GUICtrlTreeView_FindItem($hTree, "Human Interface Device", True)
_GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET)
$next = _GUICtrlTreeView_GetNext($hTree, $hItem)
; Focus treeview and Send Enter
ControlFocus("Device Manager", "", $hTree)
ControlSend("Device Manager", "", $hItem, "{ENTER}")

Exit

Thanks and Regards,

Vikram

Edited by vikrams
Posted

the way to automate such system-related tasks is rarely best handled by the GUI. have you tried DevCon?

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707(v=vs.85).aspx

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

WinPose - simultaneous fluent move and resize

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

Magic Math - a math puzzle

Demos:

Title Bar Menu - click the window title to pop-up a menu

 

Posted (edited)

thanks Orbs about Devcon, actually i want to automatation on autoit. Please if you have any idea about what is wrong in the above code

Edited by vikrams
Posted (edited)

Seems to work for me.  HID root is selected and next returns the handle for the next treeview item.

What are you trying to do with the tree view?  What do you expect to happen when you send "{Enter}"?

Also, I agree with Orbs suggestion.

Edited by spudw2k

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...