Administrators Jon Posted January 14, 2014 Administrators Share Posted January 14, 2014 I'm actually surprised the string class didn't handle a null constructor. I was positive I had that sort of thing catered for. Or maybe it used to before I rewrote the string classes from scratch ages ago. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
MysticEmpires Posted December 11, 2014 Share Posted December 11, 2014 Is this rly fixed in 3.3.12.0? I read this: https://www.autoitscript.com/trac/autoit/ticket/2613 But i get this: err.description is: Unspecified error err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 691 err.source is: SWbemObjectSet err.helpfile is: err.helpcontext is: 0 if i query somthing with no result. Somthing like this: Local $colItems = $objWMIServiceWMI.ExecQuery("SELECT * FROM WmiMonitorID WHERE Active='True'") If IsObj($colItems) then For $objComputer In $colItems Next EndIf I get the Error direct in the for. I can pre check it :/ Greetings Mystic Link to comment Share on other sites More sharing options...
water Posted December 11, 2014 Share Posted December 11, 2014 Have yozu tested with the latest Beta version as well? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 11, 2014 Share Posted December 11, 2014 Your script is no reproducer so I created the following. It works fine for me with 3.3.12.0 and 3.3.13.19 Local $sComputer = "" Local $objWMI = ObjGet('winmgmts:' & $sComputer & '\root\CIMV2') Local $colItems = $objWMI.ExecQuery("SELECT * FROM WmiMonitorID WHERE Active='True'") If IsObj($colItems) Then For $objComputer In $colItems ConsoleWrite("**" & @CRLF) Next EndIf My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
MysticEmpires Posted December 11, 2014 Share Posted December 11, 2014 (edited) Ok sry my sniped was a bit to small i think. It looks like the error-event is the Problem :/expandcollapse popupGlobal $oIEErrorHandler = ObjEvent("AutoIt.Error", "MyErrFunc") ; Datumswerte ermitteln Global $DATUM = @YEAR & "-" & @MON & "-" & @MDAY Global $ZEIT = @HOUR & ":" & @MIN & ":" & @SEC Global $ZEITDATEI = @HOUR & "_" & @MIN & "_" & @SEC Global $INIFILE = "test.ini" #region WMI-Part Local Const $wmiNamespace = "root\WMI" Local $wbemFlagReturnImmediately=0x10 Local $wbemFlagForwardOnly=0x20 Local $objWMIServiceWMI = ObjGet("winmgmts:\\" & @ComputerName & "\" & $wmiNamespace) If Not @error And IsObj($objWMIServiceWMI) Then ; Aktive Monitore abfragen Local $colItems = $objWMIServiceWMI.ExecQuery("SELECT * FROM WmiMonitorID WHERE Active='True'", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then MsgBox ( 0, "Test Script", "Start") For $objComputer In $colItems MsgBox ( 0, "Test Script", "Monitor") Next MsgBox ( 0, "Test Script", "Ende") EndIf EndIf #EndRegion #region MyErrFunc Func MyErrFunc($oError) Local $HexNumber = hex($oError.number,8) Local $Output = "err.description is: " & @TAB & $oError.description & @CRLF & _ "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oError.helpcontext _ Local $file = FileOpen("Error_" & @ComputerName & "_" & $DATUM & "_" & $ZEITDATEI & "_" & Int(Random(1, 1000)) & ".clstartup.dat", 1) If $file <> -1 Then FileWrite($file, $Output) FileClose($file) EndIf IniWrite($INIFILE, "ini", "wmi", "False") IniWrite($INIFILE, "Error", "LastError", $DATUM & " " & $ZEIT) IniWrite($INIFILE, "Error", "Scriptline", $oError.scriptline) Exit EndFunc ;==>MyErrFunc #EndRegionIf i run this Script on my Windows 7 or Windows 8 Clients i get 3 Messageboxes (Start + Monitor + End) without Error-File.If i run this script on an 2008 Server i get only the "Start" with Error-File.If i comment out the first line i runes on the 2008 Server to like on Windows 7 and Windows 8. And i dont know why :/ And Error is every time the same: err.description is: err.windescription: err.number is: 8004100Cerr.lastdllerror is: 0err.scriptline is: 24err.source is: err.helpfile is: err.helpcontext is:*EDIT*I found somthing:http://stackoverflow.com/questions/26851511/vbscript-swbemobjectset-error-8004100c8004100c on swbemobjectset means "Not supported". But how could i catch this. Actual my Script exit if it get COM-Error. But it looks this Error is fine. But i cant handle it because @error would not bet set after ExecQuery :/WmiMonitorID get suppored with Vista and Server 2008:http://msdn.microsoft.com/en-us/library/aa394542%28v=vs.85%29.aspxso dont know why this dont work. But i think it looks like not the Error from the base Thread sry Edited December 11, 2014 by MysticEmpires Link to comment Share on other sites More sharing options...
water Posted December 11, 2014 Share Posted December 11, 2014 8004100c on swbemobjectset means "Not supported". But how could i catch this. Actual my Script exit if it get COM-Error. But it looks this Error is fine. But i cant handle it because @error would not bet set after ExecQuery :/ That's easy Do not exit the script in MyErrFunc. If you do a simple Return the script continues with the next line of code. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
MysticEmpires Posted December 11, 2014 Share Posted December 11, 2014 I know But normaly i would exit on COM-Errors. I need somthing like a try Catch Link to comment Share on other sites More sharing options...
water Posted December 11, 2014 Share Posted December 11, 2014 After the statement that triggers the COM error simply query macro @error Global $oErrorHandler = ObjEvent("AutoIt.Error", "MyErrFunc") Local $colItems = $objWMIServiceWMI.ExecQuery("SELECT * FROM WmiMonitorID WHERE Active='True'", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If @error Then Exit MsgBox(0, "Error", "Error occurred!") ; Rest of code when no error Exit Func MyErrFunc($oError) EndFunc ;==>MyErrFunc My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
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