Scripting "object required" Scode:800a01a8


I am trying tu use my first script in E3.Cable. I want to assign the length to each core from the length of the bundles. So I found this script in examples:

nNSegs = Cor.GetNetSegmentIds(NSegIds)
for ns = 1 to nNSegs
NSeg.SetId NSegIds(ns)
Id = Nseg.GetId

if NSeg.IsView then
App.PutInfo 0, "NSeg " & Id & " is a view"
elseif Nseg.GetLength = 0 then
App.PutInfo 0, "NSeg " & Id & " has no length!"
l = l + Nseg.GetLength
end if


But when i execute the script, this error message is displayed: 

E - Object required.: 'Cor'
Src: Microsoft VBScript - runtime error

I started with quite easy project to test the sript (see image)

What is wrong with this script?

Thanks. Martin



  • The script is only an example of the body of the script. You need to create objects first (E - Object required.: 'Cor').

    Have a look in the help (search for "CreateDeviceObject" and have a look at the topic "List Devices". This is a complete script:

    List Devices

    set App      = CreateObject( "CT.Application" )
    set prj      = App.CreateJobObject
    if prj.getid = 0 then
        pname = "J:\tms\speed\0189\test.e3s"
        prj.Open pname 
        if prj.getid = 0 then
            App.puterror 1, "Cannot open " & PName
        end if
    end if
    set dev      = Prj.CreateDeviceObject
    set ldev     = Prj.CreateDeviceObject
    set con      = Prj.CreateDeviceObject
    set sym      = Prj.CreateSymbolObject
    set pin      = Prj.CreatePinObject
    set att      = Prj.CreateAttributeObject
    ndevs = prj.GetAllDeviceIds DevIds
    if( ndevs < 1 ) then
        App.puterror 1, "No devices in project."
        for d = 1 to ndevs
    	dev.SetId DevIds(d)
            list dev
    end if


  • Thank you for fast reply, I am newbie in programming in vbs so, probably i will need some kind of guidance.

    I tried it like this, but still not working. There is no error mesage, but nothing happened.

    Set e3 = CreateObject( "CT.Application" )
    Set job = e3.CreateJobObject
    Set cor = job.CreatePinObject

    nNSegs = Cor.GetNetSegmentIds( NSegIds )
    for ns = 1 to nNSegs
    NSeg.SetId NSegIds( ns )

    if NSeg.IsView then
    App.PutInfo 0, "NSeg " & Id & " is a view"
    elseif Nseg.GetLength=0 then
    App.PutInfo 0, "NSeg " & Id & " has no length!"
    l = l + Nseg.GetLength
    end if


  • Maybe NSeg.IsView is always false and .Nseg.GetLength is never equal to zero...

    So no info are printed on the consolle..

  • There are a number of things to do:

    1/ replace "e3" with "App" everywhere. Otherwise the "App.PutInfo" will not work

    2/ define a Segment Object

    Set NSeg = App.CreateNetSegmentObject

    3/ there are no steps in the script to select a Cor from the project.

    4/ first try to get a Visual Basic training and get experience by making some easy scripts. Also take a look at the example scripts in the Script directory in the E3 installation path

  • And add "Option Explicit" at the start of all your scripts... :)

  • As Paul G. mentioned you need to set the cor object to a wire in either a cable or within a netsegment. I modified your script so that it retrieves all cables in project first, then loops through the wires inside the cable.

    Always a good idea to set Option Explicit.

    This should get you further along.

    Set e3 = CreateObject( "CT.Application" )
    Set job = e3.CreateJobObject
    Set cor = job.CreatePinObject
    Set cab = job.CreateDeviceObject
    Set seg = job.CreateNetSegmentObject


    Dim j, intCabCount, cabIds
    intCabCount = job.GetCableIds(cabIds)

    For j = 1 to intCabCount
        cab.SetId cabIds(j)
        ' NOTE: add the id to the end of the PutInfo statement so you can click-to the cable, wire, net segment
        e3.PutInfo 0, "Cable: " & cab.GetName(), cabIds(j)
        Dim k, intCorCount, corIds
        intCorCount = cab.GetCoreIds(corIds)
        For k = 1 to intCorCount
            cor.SetId corIds(k)
            e3.PutInfo 0, vbTab & "Core Name: " & cor.GetName(), cabIds(j)
            Dim m, intSegCount, segIds
            intSegCount = cor.GetNetSegmentIds( segIds )
            Dim dblLength
            dblLength = 0
            For m = 1 to intSegCount
                seg.SetId segIds(m)

                ' NOTE: IsView does not return boolean, always compare with 1 (true) or 0 (false)
                If seg.IsView() = 1 Then
                    'NOTE: most E3 objects have a GetName()
                    e3.PutInfo 0, vbTab & vbTab & "net seg " & seg.GetName() & " is a view", segIds(m)
                End If
                If seg.GetLength() = 0 Then
                    e3.PutInfo 0, vbTab & vbTab & "net seg "  & seg.GetName() & " has no length!", segIds(m)
                    e3.PutInfo 0, vbTab & vbTab & "net seg "  & seg.GetName() & " length is " & seg.GetLength(), segIds(m)
                    dblLength = dblLength + seg.GetLength()
                End if

            e3.PutInfo 0, vbTab & "Sum of segment lengths: " & dblLength, corIds(k)
            e3.PutMessage ""
        Next ' core
        e3.PutMessage ""
    Next ' cable


  • Thank you all for the useful information. This really helped me to understand, how scripts work in E3.

    I think, now i can make my script as i need.

    But in future, i have to do some Visual Basic training to be more efficient.

    Once again, thank you so much.

Please sign in to leave a comment.

Didn't find what you were looking for?

New post