fndandan

automating driver change in device manager

5 posts in this topic

I am a newbee and wasn't able to find help by searching. I apologize if it is already here somewhere, you kind of need to know the right things to search for...

So:background

I am trying to automate the following instructions I got from a device provider. (attached below) I have to change between 2 versions of the device driver in order to work with 2 different applications.

Problem:

I get stuck when I have to choose "uninstall" at 4. I am not sure I will know how to handle the rest... but lets do it one at a time.

thanks

#Include <GuiTreeView.au3>
Run("mmc devmgmt.msc")
WinWaitActive("Device Manager")
$hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]")

$hItem = _GUICtrlTreeView_FindItem($hTree, "PCI8R3 System on a Card")
_GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET)

; Focus treeview and Send Enter
ControlFocus("Device Manager", "", $hTree)
ControlSend("Device Manager", "", $hTree, "{ENTER}")
;Sleep(500)
;MouseClick("right")
;Sleep(500)
;Send("U")

Exit

--------------------------------

1. Go to Device Manager (Control Panel/System/Hardware/Device Manager

2. click on the + box next to the Physical Acoustics/Mistras heading. A drop-down menu opens

3. right-click on PCI-8 boards

4. click uninstall

5. click on Action in the Device Manager toolbar

6. click Scan for Hardware changes

7. Hardware Wizard appears

8. click Install from a list… click Next

9. click Do not search. I will choose a driver… click Next

10. click Have Disk

11. Browse C: drive Program files

12. choose Physical Acoustics/Mistras

13. click on AEwin for SAMOS

14. click on Drivers folder

15. choose PCIAE54

16. click Finish

Share this post


Link to post
Share on other sites



I would like to automate the change between 2 versions of the device driver in order to work with 2 different applications. So I have to uninstall it first.

I am able to open the device manager, choose the right device but somehow cannot get the uninstall chosen and executed. can you help?

#Include <GuiTreeView.au3>
;run device manager
Run("mmc devmgmt.msc")
WinWaitActive("Device Manager")

;get the right device
$hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]")
$hItem = _GUICtrlTreeView_FindItem($hTree, "PCI8R3 System on a Card")
;select the right device
_GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET)

; Focus treeview and Send Enter and right-click and select uninstal
ControlFocus("Device Manager", "", $hTree)
ControlSend("Device Manager", "", $hTree, "{ENTER}")
Sleep(500)
MouseClick("right")
Sleep(500)
Send("U")

Exit

Share this post


Link to post
Share on other sites

Try it using Run/RunWait and this program. It's called DevManView from Nirsoft and with it you can uninstall a driver from its command line.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi! I'm trying to automate driver change in device manager because I have audio problem. When I am using generic Windows High Definition Audio driver sounds are working ONLY from speakers. When I am using specific driver from HP (IDT High-Definition (HD) Audio Driver) sounds are working ONLY from headphones (when plugged in).

So I would like to automate driver change.

  • Without headphones --> Windows High Definition Audio
  • When headphones plugged in --> IDT High-Definition (HD) Audio Driver
  • When headphones plugged iut --> Windows High Definition Audio

I do NOT need to uninstall drivers. I just need this action:

1. Go to Device Manager

2. Click on the + box next to the "audio, video and game controllers". A drop-down menu opens

3. Click on the High Definition Audio device or IDT High-Definition (HD) Audio Driver device

4. New window comes up. Click "Driver"

5. Click "Update Driver"

6. New window comes up. Click "find drivers from computer"

7. Click "Choose a device driver your computer's list"

8. Click right driver (High Definition Audio or IDT High-Definition (HD) Audio)
    - Note: When istalling High Definition Audio there is new windows (old driver warning). The script must click "yes" here.

9. Click "next"

10. Wait that the driver is installed then press "close"

11. Click close 

13. Close Device Manager

So far I only have scipt which opens Device Manager:

;
; AutoIt v3.0
;
#NoTrayIcon     ; AutoIt's icon doesn't show in systray

AutoItSetOption("WinTitleMatchMode", 2)     ;  this allows partial window titles to be valid!

Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE)
Beep(750,175)
Sleep(3500)
Beep(1000,75)
Beep(500,175)
WinWaitActive("Device Manager")
WinSetState ("Device Manager", "", @SW_MAXIMIZE)

Exit     ; finished

 

Share this post


Link to post
Share on other sites

Look here.

 

Saludos

Share this post


Link to post
Share on other sites

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