![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() |
Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Here is the script. (For it to work the PRNADMIN.DLL from the W2k Resource Supplement 1 needs to be registered)
Errormode(@Notify) IntControl(73,2,0,0,0) ;Port types kTcpRaw = 1 kTcpLPr = 2 kLocal = 3 kLocalDownLevel = 4 kLprMon = 5 kHPdlc = 7 oPort = CreateObject("Port.Port.1") oMaster = CreateObject("PrintMaster.PrintMaster.1") oPort.ServerName = "\\ececris1" oPort.PortName = "XP_10.10.20.27" oPort.PortType = kTcpRaw oPort.HostAddress = "10.10.20.27" oPort.PortNumber = "9100" oMaster.PortAdd (oPort) error= LastError() MESSAGE ("All done","Complete !") Errormode(@Cancel)If I try to create the same port twice I get the error. The Vartype is 1537 or a comobject
THE VBS script that this is based on returns errors from an object called Hex(Err.Number) but when I try to use that in winbatch a=getobject(Err.Number) It returns an error "Object does not exist" ...
Or try:
ErrorMode(@off) oMaster.PortAdd(oPort) ErrorMode(@cancel) if LastError() == 1261 then Message("error","There was an error creating the port.") exit endif
I need to be able to trap errors for any COM object. I am not that well versed in COM objects, is it possible that each .DLL my have its own error handling routines and this is why I cant trap them in Winbatch?
The methods and properties of all interfaces return HRESULT codes. The PrintMaster object implements the ISupportErrorInfo interface in order to provide rich error information. Besides returning the HRESULT representing the error code of the action performed, all methods and properties of PrintMaster call FormatMessage and SetErrorInfo. This is to provide the scripting client with an error object that include a string description of the error.
If this were not the case, the scripting client wouldn't be always able to set a description for the error code returned by a method of an interface. This means for all interfaces other the IPrintMaster it is not guaranteed that Err.Description will contain a string (may be empty).
The ISupportErrorInfo interface you are refering to is used to collect the same information we put in the additional info part of our error message boxes.
If you are running a current version: This information can be obtained using IntControl 73 for error handling. Upon error the variable 'wberroradditionalinfo' contains the same information the additional info part of our error message boxes.
Article ID: W16561
File Created: 2005:02:18:12:21:28
Last Updated: 2005:02:18:12:21:28