I don't think it is an AutoIT problem.
I've been getting reports from manufacturing that some of our applications have been generating an error, such as:
AUTOIT ERROR LINE 1165(X:\windows\system32\program.exe) ERROR: Subscript used w/ non-array variable
I have determined what is causing this error, and at which point, but not why and have not been able to determine a way to program around it. I am actually seeing this error in any application that reads from the WMI, here is an example script:
$sWMIService = "winmgmts:\\" & @ComputerName & "\root\CIMV2" $objWMIService = ObjGet($sWMIService) IF IsObj($objWMIService) Then $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") If IsObj($colItems) Then For $oItem In $colItems $sModel = StringReplace( $oItem.Model , "/" , "" ) Next EndIf EndIf
The application reads from WMI to get the Model number for 2 reasons. 1 it displays it on the screen and 2 it looks up that value on the server so that it can generate the GUI. Obviously, if the field is empty an error is generated. However, it does not care if it cannot find the value on the server, as if the value does not match, it shows a default message. So the way it is currently written, I know exactly what the error means when it appears. It means the field is empty. There was only 1 hardware I had where the field actually WAS empty, and it was a prototype unit. If a production unit had no value there, we would defect it out for obvious reasons.
Now on to where the error occurs. The application is compiled for 64bit.
Case where error occurs (not 100% of hardware, but 100% on the hardware it happens on unless workaround.)
- Intel BIOS has both UEFI and Legacy Boot enabled.
- BIOS-level PXE* boot to WinPE 4.0 x64
- Run application
- WMI value is an object, but the object is empty, or null.
* I don't think PXE is a requirement, but I don't boot via CD or USB.
- Disable UEFI boot in the BIOS.
If you can think of any thing I could try to find out what the problem could be, let me know. I may end up posting this question elsewhere as well.
For those who are interested, hardware effected:
Intel NUC (D33217GKE/DC3217YE)