NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to the step comment field

I am writing some custom step types for TestStand 2.0. I would like to automatically add to the comment field when someone uses the edit step. I know about the CommentOf() property to read it but can't find out how to write. Any help is appreciated.
0 Kudos
Message 1 of 5
(3,647 Views)
Within the edit step you can access the Step object as a property of the sequence context reference (SequenceContext.Step). Once you have this step reference you can use the PropertyObject.Comment method (since all but 2 TS objects inherit the PropertyObject methods) to get and set the comment of the step. Notice that within LV you must first call Step.AsPropertyObject before you can call PropertyObject.Comment. In CVI and other ADEs you can call Step.Comment directly.
Message 2 of 5
(3,647 Views)
Thanks, that did it.
0 Kudos
Message 3 of 5
(3,647 Views)
I am trying to use CVI to manipulate the comment fields of TestStand objects. Looking through the file tsapicvi.fp, I cannot find a function corresponding to PropertyObject.Comment. Is it possible to use TS_PropertyGetValString to retrieve the value of the comment field?

LabWindows/CVI 6.0.0
TestStand 2.0.1
0 Kudos
Message 4 of 5
(3,647 Views)
After posting this I found another similar discussion and the following code will solve this problem:

char * comment_str = NULL;
// ...
TS_PropertyGetProperty(hndl_prop, &errorInfo, TS_PropertyComment, CAVT_CSTRING, &comment_str);
// ...
CA_FreeMemory(comment_str);

Also note that the comment of the entire sequence file is not stored directly in the property object from the SequenceFile, but instead in the comment of the "Data" subproperty. The following code accesses the comment of a sequence file:

char * file_comment_str = NULL;
CAObjHandle hndl_seq_data_prop = 0;
// ...
TS_PropertyGetPropertyObject(hndl_prop, &errorInfo, "Data", 0, &hndl_seq_data_prop);
TS_PropertyGetProperty(hndl_seq_data_prop, &errorInfo, TS_PropertyComment, CAVT_CS
TRING, &file_comment_str);
// ...
CA_FreeMemory(file_comment_str);
CA_DiscardObjHandle(hndl_seq_data_prop);
0 Kudos
Message 5 of 5
(3,647 Views)