alansch64 0 Posted September 11, 2010 Hello, After hours of searching with no luck, I turn to you for my question. I'm new to autoit and scripting and recently learning from examples found here in the forum. A true gold mine ! The following script will return the property name of any instance of PNPDeviceID containing "FTDI" (which is a chip used for (USB/RS232) ) Of course on some computer this property name does not exist. I need to inform the user that the device was not found. My Question: How can I test "$oItem.Name" to see if it's content is empty and send out a message saying that no device was found ? I've tried to assign a variable to be able to test it..etc.. but that won't do. I'm certainly missing on an easy thing that comes from my lack of programing knowledge.. . so thanks in advance for your help. Local $wbemFlagReturnImmediately= 0x10 Local $wbemFlagForwardOnly = 0x20 Local $h_wbemFlags = $wbemFlagReturnImmediately + $wbemFlagForwardOnly $sWMIService = "winmgmts:\\" & @ComputerName & "\root\CIMV2" $objWMIService = ObjGet($sWMIService) If IsObj($objWMIService) Then $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnpEntity WHERE PNPDeviceID LIKE '%FTDI%'", "WQL", $h_wbemFlags) If IsObj($oItem) Then For $oItem in $colItems MsgBox(64, "Win32_PnpEntity", $oItem.Name) Next Else MsgBox(16, "Error", "Failed to get Win32_PnpEntity.") EndIf Else MsgBox(4096, "ERROR", "Failed to connect to WMI at: " & $sWMIService) EndIf Share this post Link to post Share on other sites
wakillon 403 Posted September 11, 2010 Try If IsObj($colItems) Then instead of If IsObj($oItem) Then AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
alansch64 0 Posted September 11, 2010 Try If IsObj($colItems) Theninstead of If IsObj($oItem) ThenThanks !I was missing the If IsObj to test the value...Works now !! Share this post Link to post Share on other sites
wakillon 403 Posted September 11, 2010 Glad to help you ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites