Jump to content

Search the Community

Showing results for tags 'device manager'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. there is a device that sometimes is exist and sometimes not, in my script I have to check if it exists if not to install it, I know how yo open device manager but don't know how to check if it exists thanks for your help!!!
  2. The below code works (requires DevCon / Windows 7) - an array of device ID strings and their names comes - but it doesn't seem right to have to manipulate the drive letter strings in the array to "fix them up" as I have done. I need a list of all devices from Devcon (including non-present devices). At the end I will check for both present and non-present devices filtered against a list of known devices so I can see which are unplugged from the computer, but first I am building the list of all devices (plugged in or not). I am doing this workaround because DevCon outputs a list with ":" delimiter and if a filter driver (for some softwares) populates a drive letter they also have ":" in the description. See my comments in the "_RunDevcon" functions for where I do this manipulation. Is there a better/smarter way to do this? #include <String.au3> #include <Constants.au3> #include <Array.au3> Global $path_Devcon = @ScriptDir & '\devcon.exe' Global $aRemovable, $strRun, $foundall $foundall = _RunDevcon('"' & $path_Devcon & '" findall *'); the findall means we will see "non present devices" _ArrayDisplay($foundall, "List of devices and their PnP IDs", -1, 0, "", "", "Index|Device String|Device Name") ; Builds a device list using devcon ; by BugFix in 2009 and modified for this script Func _RunDevcon($strRun) Local $data, $dvcn = Run("cmd.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($dvcn, $strRun & @CRLF) StdinWrite($dvcn) While True $data &= StdoutRead($dvcn) If @error Then ExitLoop Sleep(25) WEnd Local $split = StringSplit($data, @LF) $data = '' For $i = 5 To $split[0] If StringStripWS($split[$i], 8) == '' Then ExitLoop $data &= $split[$i] Dim $devices[1][1] $devices = StringSplit($data, @CRLF) Next _ArrayDelete($devices, $devices[0] - 1); because the last line is "<number> matching device(s) found." $devices[0] = UBound($devices, 1) ;~ Some hoops to jump because Devcon returns a list of devices with ;~ a ":" in their descriptions and the delimiter between the devices is a ":"! $dvstr = _ArrayToString($devices, "'"); split array to string $dvstr_fixed = StringReplace($dvstr, ":", "!", 0, 2); replace the colons with something else $devarray = _String_Split($dvstr, "'", ":"); put all back into an array For $j = 1 To $devarray[0][0] - 1; we remove leading whitespace from second column If $devarray[$j][2] = "\" Then; now we fix the drive letters to have a colon again $Noblank = StringReplace($devarray[$j][1] & ":" & $devarray[$j][2], " ", "", 1) $devarray[$j][1] = $Noblank Else $Noblank = StringReplace($devarray[$j][1], " ", "", 1) $devarray[$j][1] = $Noblank EndIf Next _ArrayDeleteCol($devarray, 2); now we can delete the not-needed column _ArrayDelete($devarray, $devarray[0][0] - 1); we ended up with a blank at the end $devarray[0][0] = UBound($devarray, 1) Return $devarray EndFunc ;==>_RunDevcon ;~ Splits a string into an multidimensional array ;~ By wolf9228 in 2009 Func _String_Split($string, $delimiters1, $delimiters2) $Array1 = StringSplit($string, $delimiters1) Dim $MAXUBound = 0, $OutArray2[1][1] For $i = 1 To $Array1[0] Step 1 $OutArray = StringSplit($Array1[$i], $delimiters2) If $MAXUBound < $OutArray[0] Then ReDim $OutArray2[$i][$OutArray[0]] $MAXUBound = $OutArray[0] Else ReDim $OutArray2[$i][UBound($OutArray2, 2)] EndIf For $j = 1 To $OutArray[0] Step 1 $OutArray2[$i - 1][$j - 1] = $OutArray[$j] Next Next Return $OutArray2 EndFunc ;==>_String_Split ;~ Deletes column from array ;~ By PsaltyDS in 2008 Func _ArrayDeleteCol(ByRef $avWork, $iCol) If Not IsArray($avWork) Then Return SetError(1, 0, 0); Not an array If UBound($avWork, 0) <> 2 Then Return SetError(1, 1, 0); Not a 2D array If ($iCol < 0) Or ($iCol > (UBound($avWork, 2) - 1)) Then Return SetError(1, 2, 0); $iCol out of range If $iCol < UBound($avWork, 2) - 1 Then For $c = $iCol To UBound($avWork, 2) - 2 For $r = 0 To UBound($avWork) - 1 $avWork[$r][$c] = $avWork[$r][$c + 1] Next Next EndIf ReDim $avWork[UBound($avWork)][UBound($avWork, 2) - 1] Return 1 EndFunc ;==>_ArrayDeleteCol
×
×
  • Create New...