Click here to Skip to main content
16,007,277 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: BindingSource variable used before being assigned a value Pin
AAGTHosting3-Jan-08 9:54
AAGTHosting3-Jan-08 9:54 
GeneralTableAdapter.FillBy Method Pin
AAGTHosting5-Dec-07 10:12
AAGTHosting5-Dec-07 10:12 
GeneralRe: TableAdapter.FillBy Method Pin
Dave Kreskowiak5-Dec-07 11:01
mveDave Kreskowiak5-Dec-07 11:01 
GeneralRe: TableAdapter.FillBy Method Pin
AAGTHosting5-Dec-07 12:20
AAGTHosting5-Dec-07 12:20 
GeneralRe: TableAdapter.FillBy Method Pin
Dave Kreskowiak5-Dec-07 16:24
mveDave Kreskowiak5-Dec-07 16:24 
GeneralRe: TableAdapter.FillBy Method Pin
AAGTHosting3-Jan-08 12:22
AAGTHosting3-Jan-08 12:22 
GeneralRe: TableAdapter.FillBy Method Pin
Dave Kreskowiak3-Jan-08 14:18
mveDave Kreskowiak3-Jan-08 14:18 
GeneralVBscript - not reading/holding string issue Pin
DFG5-Dec-07 10:03
DFG5-Dec-07 10:03 
Initial Problem:
When Imaging numerous computers, they use the same SigmaTel device - and the DeviceID is the same. However, each different model MUST use a different driver version or the SigmaTel sound driver will not function. (That's messed up! - who wrote these Gateway model drivers!)

So... we're trying to develop a script that recognizes/pulls the DeviceID and Model, then depending on what computer model and DeviceID is found, then the correct driver should be loaded.

The VBS problem: The IF statements do not seem to be reading in the string variables (the objItem.Name). It does not seem to read it and is blank.

Anyone have any suggestions / solutions on this one! Any help is appreciated.

======Code:

On Error Resume Next

strComputer = "."
strName = objItem.Name
Dim objFSO ' File System Object
Dim objShell ' Window Shell Object
Dim ObjExec ' Execute command in Shell
Dim strResult ' Output from command execution
Dim strDeviceID ' Device ID of whatever we've found
Dim strDeviceIDShort ' Four-digit ID of device
Dim strDeviceIDLong
Dim strDeviceDesc ' Text description of device
Dim intNumDevices ' Just in case there's more than one, we'll want to know
Dim arrTemp
Dim strTemp
Dim Counter
Dim strComputers ' Computers this might be
Dim strINFFile ' What INFFile we're going to use


Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)

'For Each objItem in colItems
'WScript.Echo "whois:" & objItem.Name
'Next

Wscript.Echo
Wscript.Echo "Looking for unconfigured High-Definition Audio Device..."
Wscript.Sleep 500

set objExec = objShell.Exec("c:\windows\devcon find *HDAUDIO\*")
strResult = objExec.StdOut.ReadAll
if InStr(strResult, "device(s)") <> 0 then
arrTemp = Split(strResult, vbcrlf)
If UBound(arrTemp) > 2 then
For Counter = 0 to (UBound(arrTemp) - 1)
If InStr(arrTemp(Counter), "Audio") <> 0 then
strTemp = arrTemp(Counter)
End if
If InStr(UCase(arrTemp(Counter)), "FOUND") <> 0 then
intNumDevices = CInt(Left(arrTemp(Counter), 1))
End if
Next
Else
strTemp = arrTemp(0)
intNumDevices = CInt(Left(arrTemp(1), 1))
End if
arrTemp = Split(strTemp, ":")
strDeviceIDLong = arrTemp(0)
strDeviceDesc = Trim(arrTemp(1))
arrTemp = Split(strDeviceIDLong, "&")
strDeviceID = arrTemp(0)
strDeviceIDShort = Right(Mid(strDeviceIDLong, InStr(strDeviceIDLong, "DEV_"), 8), 4)
Wscript.Echo "Found " & intNumDevices & " Hi-Def Audio Device(s)."
Wscript.Echo "Gathering information..."
Wscript.Echo
Else
Wscript.Echo "There are no Hi-Def Audio Devices present in the system."
Wscript.Echo "Exiting..."
wscript.Sleep 200
End if

For Each objItem in colItems

Select Case strDeviceIDShort
Case "7680"
strComputers = "Gateway E-4500, E-6610"
If objItem.Name = "E-6610D" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\070AC97\sthda.inf"
ElseIf objItem.Name = "E-6610" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\070AC97\sthda.inf"
ElseIf objItem.Name = "E4500" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
ElseIf objItem.Name = "E-4500D" then
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
End If
Case "7618"
strComputers = "Gateway E-4610, E-4610D"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\040AC97\sthda.inf"
Case "7634"
strComputers = "Gateway M465, M685, E-100M"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\020AC97\sthda.inf"
Case "7690"
strComputers = "Gateway E-475M, E-100M"
strINFFile = "C:\Drivers\060Audio\010Sigmatel\050AC97\sthda.inf"
Case Else
strComputers = "Unknown computer system"
strINFFile = "Not making any changes."
Wscript.Quit
End Select



Wscript.Sleep 350
Wscript.Echo "Driver Device ID: " & StrDeviceIDShort
Wscript.Echo "Device Description: " & strDeviceDesc
Wscript.Echo "System Device ID: " & strDeviceID
WScript.Echo
WScript.Echo "Possible Systems: " & strComputers
WScript.Echo "Device Driver to use: " & strINFFile
Wscript.Echo
Wscript.Echo "Attempting to update driver..."
WScript.Echo "whois:" & objItem.Name

Next

'WScript.Quit

Set objExec = objShell.Exec("c:\windows\devcon updateni " & strINFFile & " " & strDeviceID)
Wscript.Sleep 5000
strResult = objExec.StdOut.ReadAll
Wscript.Echo strResult
DFG
GeneralRe: VBscript - not reading/holding string issue Pin
Dave Kreskowiak5-Dec-07 10:46
mveDave Kreskowiak5-Dec-07 10:46 
GeneralRe: VBscript - not reading/holding string issue Pin
DFG5-Dec-07 10:55
DFG5-Dec-07 10:55 
GeneralRe: VBscript - not reading/holding string issue Pin
Dave Kreskowiak5-Dec-07 11:03
mveDave Kreskowiak5-Dec-07 11:03 
GeneralOutput Directory Pin
Fahad Sadah5-Dec-07 6:37
Fahad Sadah5-Dec-07 6:37 
GeneralRe: Output Directory Pin
Dave Kreskowiak5-Dec-07 8:02
mveDave Kreskowiak5-Dec-07 8:02 
GeneralRe: Output Directory Pin
harveyhanson5-Dec-07 23:00
harveyhanson5-Dec-07 23:00 
GeneralOpening an embedded word document with MS Word automation [modified] Pin
craigmg785-Dec-07 5:15
craigmg785-Dec-07 5:15 
GeneralRe: Opening an embedded word document with MS Word automation Pin
Dave Kreskowiak5-Dec-07 6:17
mveDave Kreskowiak5-Dec-07 6:17 
GeneralRe: Opening an embedded word document with MS Word automation [modified] Pin
Thomas Krojer5-Dec-07 6:21
Thomas Krojer5-Dec-07 6:21 
QuestionConnecting to an online mySQL server? Pin
Benny_Lava5-Dec-07 1:43
Benny_Lava5-Dec-07 1:43 
AnswerRe: Connecting to an online mySQL server? Pin
Dave Kreskowiak5-Dec-07 5:04
mveDave Kreskowiak5-Dec-07 5:04 
GeneralCrystal Report Deployment Pin
poonams5-Dec-07 1:19
poonams5-Dec-07 1:19 
GeneralRe: Crystal Report Deployment Pin
Ujjaval Modi5-Dec-07 2:12
Ujjaval Modi5-Dec-07 2:12 
GeneralRe: Crystal Report Deployment Pin
poonams11-Dec-07 18:40
poonams11-Dec-07 18:40 
GeneralRe: Crystal Report Deployment Pin
Ujjaval Modi12-Dec-07 1:03
Ujjaval Modi12-Dec-07 1:03 
QuestionSaving data from gridvies -> dataset -> database Pin
zwaailicht5-Dec-07 0:09
zwaailicht5-Dec-07 0:09 
QuestionRe: Saving data from gridvies -> dataset -> database Pin
H.A.Faheem5-Dec-07 0:45
H.A.Faheem5-Dec-07 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.