LisHawj Posted July 2, 2019 Posted July 2, 2019 I am writing a script to identify laptop models and compare it with a reference variable. If the computer model string match, then the script execute other functions. I have written the following, but the script reports the value/strings do not match. Am I overlooking something simple here? Global $e5490 = "Latitude 5490" $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $Output = $objItem.Model & @CRLF Next Else Sleep(10) EndIf Msgbox(0,"",$Output) $i = StringCompare($Output,$e5490) If $i = 0 Then MsgBox(0,"","Yes! A match!") Else MsgBox(0,"","No! Not a match!") EndIf
Gianni Posted July 2, 2019 Posted July 2, 2019 don't append the @CRLF to the $Output variable LisHawj 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
LisHawj Posted July 2, 2019 Author Posted July 2, 2019 (edited) @Chimp Please take me to the range and shoot me, dear lord! Thank you very much. Edited July 3, 2019 by LisHawj Forgot to thank @Chimp!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now