Run-time error #464

Michael S.
Cheltenham, Gloucestershire

Mar 13, 2014
4 Posts

0  |  0  

Re: Run-time error #464

Hello

I’ve have three programs in my project: Program1.pgt, Program2.pgt and Program3.pgt

The code below is all in a system.

I select a program using a list box (lbPrograms). The list box is populated with:

for iProgram = 0 to App.ProgramsCount-1
    m_frmTestManagerLoad.lbPrograms.AddItem(App.Programs(iProgram).Name())
next

Program to run is selected with:

for iProgramNumber = 0 to (m_frmTestManagerLoad.lbPrograms.ListCount()-1)
    if m_frmTestManagerLoad.lbPrograms.Selected(iProgramNumber) then
        m_vProgram = iProgramNumber
    endif
next

Tasks from selected program put into list box (lbTasks) so I can select what to run:

appPrograms = App.Programs(m_vProgram)

for iTask = 0 to appPrograms.TestsCount - 1
    atTask = appPrograms.Tests(iTask)
    m_frmTestManager.lbTasks.AddItem(atTask.Name)
next


I select a task and press the start button

Start button calls procedure RunTasks()

RunTask()
appPrograms = App.Programs(m_vProgram)

! only run tasks that have been selected by the operator in list box lbTasks
for iTaskNumber = m_iTaskNumber to (m_frmTestManager.lbTasks.ListCount() - 1)
    ! increment m_iTaskNumber so when RunTask() called again by OnEndTask() we move to the next task
    m_iTaskNumber = m_iTaskNumber + 1
    if m_frmTestManager.lbTasks.Selected(iTaskNumber) then
        atTask = appPrograms.Tests(iTaskNumber)
        Task atTask.Id ! Run-time error generated here
    endif
next

Selecting Program1 (m_vProgram = 0) and tasks run correctly,
however selecting Program2 (m_vProgram = 1) and atTask.Id generates the following error:
“Run-time error #464 : 'No Task or Test with given number' found in 'TestManager.RunTasks' in line 9”

atTask.Id returns the correct value that was assigned to it in the IDE.

What have I missed?

Thanks
Michael

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

Mar 13, 2014
358 Posts

1  |  0  

Re: Run-time error #464

This will not work.
You need to:

1. First run the program using the RUN statement.
2. In the OnInitProgram() event, you need to jump to the task (cash it to a global variable) using the TASK statement.

Michael S.
Cheltenham, Gloucestershire

Mar 14, 2014
4 Posts

0  |  0  

Re: Run-time error #464

Thanks DrATEasy!

I changed my code so:

Start button executes Run App.Programs(m_vProgram)

OnInitProgram() calls first iteration of RunTasks()

I can now select and run programs from a list

Thanks again
Michael



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]