analitics

Pages

Sunday, May 26, 2019

Python 3.7.3 : Using the win32com - part 005.

Another example with win32com python module:
This script show info about the audio or video codec, see this link:
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_CodecFile")
for objItem in colItems:
    print("Access Mask: " , objItem.AccessMask)
    print("Archive: " , objItem.Archive)
    print("Caption: " , objItem.Caption)
    print("Drive: " , objItem.Drive)
    print("Extension: " , objItem.Extension)
    print("File Name: " , objItem.FileName)
    print("File Size: " , objItem.FileSize)
    print("File Type: " , objItem.FileType)
    print("File System Name: " , objItem.FSName)
    print("Group: " , objItem.Group)
    print("Hidden: " , objItem.Hidden)
    print("Manufacturer: " , objItem.Manufacturer)
    print("Name: " , objItem.Name)
    print("Path: " , objItem.Path)
    print("Version: " , objItem.Version)
The output is this:
File Type:  Application Extension
File System Name:  NTFS
Group:  Video
Hidden:  False
Manufacturer:  Microsoft Corporation
Name:  C:\Windows\system32\MSVIDC32.DLL
Path:  \windows\system32\
Version:  6.3.9600.17415
Access Mask:  1179817
Archive:  True
Caption:  c:\windows\system32\l3codeca.acm
Drive:  c:
Extension:  acm
File Name:  l3codeca
File Size:  82432
File Type:  acm File
File System Name:  NTFS
Group:  Audio
Hidden:  False
Manufacturer:  Fraunhofer Institut Integrierte Schaltungen IIS
Name:  C:\Windows\system32\L3CODECA.ACM
Path:  \windows\system32\
Version:  1.9.0.401