LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get control information from .ctl

Hello everyone,

 

I am designing an application where it will be helpful to get the information of a control from a .ctl file. I would like to use this information to later typecast some variant information.

 

Any clue on that?

 

Thanks in advance!

0 Kudos
Message 1 of 6
(3,276 Views)

Hi cgh,

 

which "information" do you need?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,271 Views)

Hi GerdW,

 

The idea is that I have in a text file with something like this:

 

function_name(variable1, variable2)

 

This not C, it is something else designed long ago that we have to import somehow. There are several defined functions that should be interpreted and I already have one typedef control to allocate the function input data. Now it is necessary to convert the strings into the specific data. With numeric variables is quite easy to do. The problem is with enums. Depending on the function_name it is possilbe to have the corresponding cluster in variant format. From it, it is possible to know which is the ctl that contains the enum definition. Then I would like to use this ctl to somehow typecast the enum. Right now is the more automatic way that I can foresee but I don't know the exact way to do it.

 

Any help will be appreciated.

 

Best regards,
cgh 

 

Best regards,

Carlos

 

 

0 Kudos
Message 3 of 6
(3,238 Views)

Hi Carlos,

 

to typecast "something" into an enum you need to know that enum in advance…

 

Depending on the function_name it is possilbe to have the corresponding cluster in variant format.

When you know the "cluster" format (I thought you were talking baout enums?) then you can create a VI doing the needed conversion without needing to "parse" some ctl files! I still don't get what you really want to achieve…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,229 Views)

There are multiple ways to do this, and before I start with an example on how to parts .ctrl files, or showing scripting examples, or showing the Variant Data Parsing Palette, I too would like to know what information you want, and to see some example of how the data is coming in.  Is this in a running VI?  Will this be in an EXE?  Will LabVIEW be used at all?

0 Kudos
Message 5 of 6
(3,227 Views)

I am not sure if I understand exactly what you are trying to do...

 

This Nugget talks about how to use control references to explore an undefined control type.

 

If you are just looking to get the string that goes with a enum then "format into string" will work.

 

There are also function under the variant>>> Data type parsing palette that may be of interest to you.

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(3,226 Views)