Jump to content

Enumerate Webcams & Videodevices - Step 1


Recommended Posts

Yo,

I like to enumerate all connected webcams/videodevices of the computer.

I know all the current Webcam UDF's here, so don't link me to them ;)

I like to try it myself, coding something from scratch

What I like to achieve in the end is make a webcam snapshot by selecting the webcam

by name, and then take a snapshot, without displaying the videosourcedialog.

My first step to achieve this is to grab all webcam devices.

So far, this lists the usb devices, and the last entry is the webcam.

 

ewlcjfx3.jpg

What does it show on your computer?

If you reply, please tell me, how many webcams you have, what os, architecture and the webcam names^^

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity where DeviceID like 'USB\\%'")

If IsObj($colItems) then
    For $objItem In $colItems
        WriteDevice("--------------------------------------")
        WriteDevice("Caption: " & $objItem.Caption)
        WriteDevice("DeviceId: " & $objItem.DeviceID)
    Next
Endif


Func WriteDevice($sText)
    ConsoleWrite($sText & @LF)
EndFunc

How can I filter that it only displays video devices/webcams?

I have 2 webcams on my pc, so it should show them, by there correct name

Similar to Skype:

gdyj5j2w.jpg

A friend of mine tested my snippet above aswell, and he told me that the last entry is always the webcam.

Can I filter them out somehow?

And what if there are mote than one webcams?

This is only the first step of 3, please only help me about the filtering part, atm i am not interessted in snapshoting yet.

Thats the next step^^

 

Link to comment
Share on other sites

  • 2 months later...

I hate this stupid autoit code displayed in forum. If you copy and paste it in the script, it ends up being 1 line so i have to copy each line and paste it into eh script :pirate:

 

this happens with Firefox. There is a workaround, just copy the code by selecting all, but leave out at least one character. Then paste it to SciTE, In this way all @cr will be preserved and you will have to enter by hand only the first (or the last) char.

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...