-1

The error is:

object required: ''; code: 800A01A8.

At this line:

Set gECU.Name = "random name"

Code:

Dim app, config, generalSetup, XCPSetup, ECUs, ECU, gECU, gDBSignals

Set app          = CreateObject("CANoe.Application")
Set config       = app.Configuration
Set generalSetup = config.GeneralSetup
Set XCPSetup     = generalSetup.XCPSetup
Set ECUs         = XCPSetup.ECUs

'Add a new ECU with XCP on CAN
Set ECU = ECUs.Add("D:\Script_CANoe_Automation\INPUTS\path.A2L", cTlFlex)
Set gECU.Name = "random name"
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • You don't have an object reference called `gECU` try `ECU.Name` instead without the word `Set`. You do not need `Set` when updating an object property only when creating object references is it necessary. – user692942 Nov 18 '19 at 07:08
  • I still got an objet required problem with ECU.name and without Set. – Tomici Bogdan Nov 18 '19 at 07:19
  • In which case `ECU` is also not an object reference. Seems like you have a lot of issues with using `Set` when it is not necessary which is giving the `Object Required` errors. Are you sure `ECUs.Add()` returns an object reference? – user692942 Nov 18 '19 at 07:33
  • What is the output of `WScript.Echo TypeName(ECU)`? – Ansgar Wiechers Nov 18 '19 at 08:33
  • 1
    I used set for all variables above because I had errors if I didn't use Set (at each line where now I use "Set"). If I use WScript.Echo TypeName(ECU), I get: "Nothing " – Tomici Bogdan Nov 18 '19 at 08:52
  • 1
    @Ansgar Wiechers If I use:WScript.Echo varType(ECU) .... answer is: 9.As I'm new to this language, I'm not sure if this is the type it should return.Any hint is appreciated. – Tomici Bogdan Nov 18 '19 at 08:59
  • Do `TypeName` and `VarType` look identical to you? If not: why didn't you do what I asked you to do? – Ansgar Wiechers Nov 18 '19 at 09:08
  • 1
    @Ansgar Wiechers For WScript.Echo TypeName(ECU) ....I get: "Nothing" – Tomici Bogdan Nov 18 '19 at 09:10
  • @AnsgarWiechers they shouldn't be identical, if an object reference has no object it will be `Nothing`. It's still an object reference *(`vbObject` or `9`)* it just has no object *(`Nothing`)*. – user692942 Nov 19 '19 at 06:21
  • 1
    @Lankymart Knowing that something is an object reference *and* that it doesn't point to an object is substantially more information than just knowing that it's an object reference, wouldn't you agree? Anyway, to me it looks like `Add()` doesn't return the object the OP expects. I don't know enough about CANoe to make anything of that, though. – Ansgar Wiechers Nov 19 '19 at 08:56
  • @AnsgarWiechers completely agree, just seemed the OP answered both your questions but you seemed unhappy with the result. It's not a great question to be honest and should probably be flagged for closure. – user692942 Nov 19 '19 at 09:14
  • 1
    Ah, my bad. For some reason I completely missed the first comment. Apologies @TomiciBogdan. – Ansgar Wiechers Nov 19 '19 at 09:32

1 Answers1

0

object required: ''; code: 800A01A8.

The WScript object gECU here

Set gECU.Name = "random name"

does not exist because you have not yet assigned an object reference to this variable

object.Name is defined as one of the properties of the McMeasurementGroup (object represents a set of parameters and their measurement settings for CCP/XCP measurements.)

If you wish to add an XCP connection to the ECU and enable one parameter contained in the database for DAQ measurement-do it this way:

Dim gApp, gConfig, gGeneralSetup, gXCPSetup, gECUs, gECU, gSignals, groups, group, parameters, parameter

'From the Property "ECUs" of "Application.Configuration.GeneralSetup.XCPSetup"
gApp          = CreateObject("CANoe.Application")
gConfig       = gApp.Configuration
gGeneralSetup = gConfig.GeneralSetup
gXCPSetup     = gGeneralSetup.XCPSetup
gECUs         = gXCPSetup.ECUs

‘You can add a new ECU with XCP on CAN
Set gECUs = gECUs.Add("D:\Script_CANoe_Automation\INPUTS\path.A2L", CANoe.eMcTransportLayer.cTlCan)

'You can find an existing ECU
gECU  = gECUs("XCPsim")

'or change settings
gECU.ConnectOnMeasurementStart        = 1
gECU.DisconnectOnMeasurementStop      = 1
gECU.ObserverActive                   = 1
gECU.PageSwitchingActive              = 1
gECU.RAMpage                          = 1
gECU.ResetVariablesAfterDisconnect    = 1
gECU.UseDAQTimestampsOfECU            = 1
gECU.UseDAQTimestampsOfECUDivOperator = 0

'or access the parameters contained in the database
groups     = ECU.MeasurementGroups
group      = groups.Item(1)
group.Name = "random name"
parameters = group.Parameters

'Enable a parameter for DAQ measurement
parameter            = parameters("channel2")
parameter.Configured = 1
parameter.ReadMode   = CANoe.eMcReadMode.cDAQ
parameter.EventCycle = 1
parameter.AutoRead   = 1
Om Choudhary
  • 492
  • 1
  • 7
  • 27