Sign in to follow this  
Followers 0
PsaltyDS

Controls without ControlIDs?

6 posts in this topic

I have only been coding AutoIT for a month, but I love it! I've already cranked out some usefull stuff at work, automating some Install/Config processes. ;)

All that sucking up is to butter y'all up for yet another dumb question... :lmao:

I am automating the driver install for a QLogic HBA. My script opens DevMgmt.msc, and sends {Tab}, "o", which selects the "Other Devices" line in the console. Directly under that is "Fibre Channel Controller", with a big yellow question mark icon, because it doesn't have a driver yet. I can send {Down}, {Enter} to open properties for the controller, but that ASSUMES the first thing in the Other Devices list is the right controller.

Wanting to tag the controller more directly, I ran AutoIT Info looking for a class or control ID I could use, but the whole window appears to be one big control with no identifying features for the individual items. When I mouse over or click to select the controller, nothing changes in Info.

I do know the exact text of the line I want to select, "Fibre Channel Controller". But that doesn't show up in "Visible Text" of Info. Can I somehow select the line in the msc?


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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

The crickets I'm hearing are not helping...

This might not be much more help than those crickets, but you might want to move away from DevMgmt.msc and take a look at DevCon. DevCon is a command-line utility that functions as an alternative to Device Manager.

http://support.microsoft.com/default.aspx?...b;EN-US;Q311272

You can search the forum for many posts about DevCon.

If you want to stick with devmgmt.msc, instead of sending that last "down" send "Fibre" or the whole name... as long as you send it fast enough.

Here is a sample script that does what I mentioned - sending more than just the first letter.

The second WinActivate/WinWaitActive lines seemed to be needed for my system:

Run(@comspec & " /c devmgmt.msc", "", @sw_hide)
WinWait("Device Manager")
WinActivate("Device Manager")
WinWaitActive("Device Manager")
Send("{TAB}")
Sleep(500)
Send("Network Devices")
Sleep(500)
WinActivate("Device Manager")
WinWaitActive("Device Manager")
Send("Cisco")
You can search the forum for devmgmt for better examples............ Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

This might not be much more help than those crickets, but you might want to move away from DevMgmt.msc and take a look at DevCon. DevCon is a command-line utility that functions as an alternative to Device Manager.

http://support.microsoft.com/default.aspx?...b;EN-US;Q311272

You can search the forum for many posts about DevCon.

If you want to stick with devmgmt.msc, instead of sending that last "down" send "Fibre" or the whole name... as long as you send it fast enough.

Here is a sample script that does what I mentioned - sending more than just the first letter.

The second WinActivate/WinWaitActive lines seemed to be needed for my system:

Run(@comspec & " /c devmgmt.msc", "", @sw_hide)
WinWait("Device Manager")
WinActivate("Device Manager")
WinWaitActive("Device Manager")
Send("{TAB}")
Sleep(500)
Send("Network Devices")
Sleep(500)
WinActivate("Device Manager")
WinWaitActive("Device Manager")
Send("Cisco")
You can search the forum for devmgmt for better examples............
Hey, that might be just the thang! :lmao:

I'll give it a try Monday... thanks!

We noticed when testing it manually, that hitting "o" then "f" on the actual keyboard only jumped as expected about every third keystroke. Seems to be a really balky interface, in other words, it's Windows alright... o:)

I'll start reading up on DevCon.

;)


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

Share this post


Link to post
Share on other sites

This might not be much more help than those crickets, but you might want to move away from DevMgmt.msc and take a look at DevCon. DevCon is a command-line utility that functions as an alternative to Device Manager.

http://support.microsoft.com/default.aspx?...b;EN-US;Q311272

You can search the forum for many posts about DevCon.

You are ever so much better than crickets!

DevCon worked! :lmao:

Took half a morning once I got to work today to download and check out DevCon.exe and find the right "Hardware ID" for my HBA card. Then I changed my script, replacing about a hundred lines of code that tried to deal with the DevMgmt.msc window with:

$ScriptName = @ScriptName
$ScriptNameErr = $ScriptName & " Error!"

$InfFile = '"\\MyServer\MyShare\qlogic driver\oemsetup.inf"'
$HwId = '"PCI\VEN_1077&DEV_2312&SUBSYS_01001077&REV_02"'
$InstCmd = "\DevCon.exe install " & $InfFile & " " & $HwId

$RetCode = RunWait(@ComSpec & " /c " & @ScriptDir & $InstCmd, @TempDir, @SW_SHOW)
If $RetCode = 0 Then
    MsgBox(32, $ScriptNameMsg, "QLogic QLA2340 HBA driver installed successfully.", 10)
Else
    MsgBox(16, $ScriptNameErr, "Error installing QLogic QLA2340 HBA driver, return code was: " & $RetCode)
EndIf

Note that you must have the double quotes on the strings, which are preserved by the single quotes above, otherwise the command shell parses the ampersand '&' in the hardware ID, and it goes kablooey...

Thanks for a great tip!

;)


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

Share this post


Link to post
Share on other sites

You are welcome. Glad it worked for you.

...better than crickets!

That sounds like a good "Custom member title" for a while....


[size="1"][font="Arial"].[u].[/u][/font][/size]

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
Sign in to follow this  
Followers 0