Home Image-Pro Automation (Macros, Apps, Reports)

Type identifier for statsclass

HI ,

I have some strange debugger behavior I can't explain:

Two projects, basically the same (one is a new project with the same module loaded and just differs in a few aspects later (ROI save and ROI reload...)

They are equally defined:

"XXXXXXXXXXXXXXX  FIRST  XXXXXXXXXXXXXXXXXXX

Imports MediaCy.Addins.ThresholdTool
Imports MediaCy.Viewers.Set
Imports MediaCy.IQL.Sets
Imports MediaCy.IQL.Features
Imports MediaCy.Addins.Measurements.Gadgets
Imports MediaCy.Addins.Measurements
Imports MediaCy.Addins.SCalibration.Commands
Imports MediaCy.Addins.Scripting
Imports MediaCy.Addins.SCalibration
Imports MediaCy.Addins.Scripting.Workflow
Imports MediaCy.Viewers.Image
Imports MediaCy.Addins.ThresholdTool.Gadgets
Imports System
Imports System.IO


Public Module MeasureSCI_FL

Dim Imname, OutputVar
Dim IRArea, IRAreaPercent, MeanSignal, ROISize, H1, H2, Imname2, D

    Public Function Measure2() As SimpleScript
        Measure2 = New SimpleScript
        Dim stats2 As StatsClass
        Dim doc1, ROIname,  mdata2
"XXXXXXXXXXXXXXX  SECOND  XXXXXXXXXXXXXXXXXXX
Imports MediaCy.Addins.ThresholdTool
Imports MediaCy.Viewers.Set
Imports MediaCy.IQL.Sets
Imports MediaCy.IQL.Features
Imports MediaCy.Addins.Measurements.Gadgets
Imports MediaCy.Addins.Measurements
Imports MediaCy.Addins.SCalibration.Commands
Imports MediaCy.Addins.Scripting
Imports MediaCy.Addins.SCalibration
Imports MediaCy.Addins.Scripting.Workflow
Imports MediaCy.Viewers.Image
Imports MediaCy.Addins.ThresholdTool.Gadgets
Imports System
Imports System.IO



Public Module MeasureSCI_FL_reload

Dim Imname, OutputVar
Dim IRArea, IRAreaPercent, MeanSignal, ROISize, H1, H2, Imname2, D

    Public Function Measure2() As SimpleScript
        Measure2 = New SimpleScript
	Dim stats2 As StatsClass
        Dim doc1, ROIname,  mdata2
        
However, in the second case it tells me that StatsClass is an invalid type:
Don't find a way to explain and get it working...
Many thx
Daniel



Comments

  • edited January 2016
    Hi Daniel,

    Types are defined in References and namespaces are declared as "Imports". If you get Invalid Type error, it may mean that you don't have proper reference in your project. In case of StatsClass the reference to MediaCy.Addins.Measurements.dll has to be present in your project (you can get that info from the Automation help).please check it (you can check it clicking the References button on the Scripts tab of Project Workbench).
    Note, that references and Imports are added automatically when you record a macro, but they are not added if you just paste code or write it manually.

    If you have a working project and want to copy code from this project to another, the best way to ensure that all references and Imports are added, is to use Dependencies Export/Import menu items, which you can find on the Edit tab of the Project Workbench ribbon.

    Regards,

    Yuri
  • Thanks Yuri
  • HI Yuri,


    I always also copy the references, as you can see that the reference should be imported by the code. Though the solutions seems to be to also manually check the references  in the references dialog. Then It works.


    Thanks


    Dan

Sign In or Register to comment.