04-23-2012 12:36 PM
How can I get the name of the process model in CVI?
The process model is switched between sequential and batch model and need to obtain the name of the currently used process model.
In the fiunction
CVIVALLBACK ApplicationMgr_OnStartExecution(
CAObjHandle caServerObjHandle, void* caCallBackData, TSUIObj_Execution execution, TSUIObj_Thread thread, VBOOL initiallyHidden)
{
CAObjHandle processModelSeqFileName;
char *processModelName = {0};
tsErrChk( TS_ExecutionGetModelSequenceFile (gMainWindow.engine, &errorInfo, &processModelSeqFileName));
tsErrChk( TS_SequenceGetName (processModelSeqFileName, &errorInfo, &processModelName));
........
if(processModelSeqFileName)
CA_DiscardObjHandle(processModelSeqFileName);
CA_FreeMemory(processModelName);
}
The function TS_ExecutionGetModelSequenceFile () returns "No such interface supported"?
TIA.
04-23-2012 02:34 PM - edited 04-23-2012 02:36 PM
TS_ExecutionGetModelSequenceFile is a function on the Execution class as denotes by the TS_Execution prefix. Its first parameter must be an execution, not the engine.
The TS_SequenceGetName call has a similar issue.
04-23-2012 03:28 PM
Yes I did test using Execution and still the same error is returned.
04-23-2012 03:31 PM
James,
Here is how the function looked like:
tsErrChk( TS_ExecutionGetModelSequenceFile (execution, &errorInfo, &processModelSeqFileName));
But execution is of TSUIObj_Execution execution, beleive it should not matter, correct?
04-24-2012 11:50 AM
Here are the changes made that got rid of the error but still does not get the process model path. processModelName in TS_SeqFileGetModelSeqFile returns "none" always and SeqFileObject is zero, any ideas?
if(execution)
{
tsErrChk( TS_ExecutionGetModelSequenceFile (execution, &errorInfo, &processModelSeqFileHdl));
if( processModelSeqFileHdl )
{
tsErrChk( TS_SeqFileGetModelSeqFile (processModelSeqFileHdl, &errorInfo, &processModelName, &SeqFileObject ));
if( SeqFileObject )
tsErrChk( TS_SeqFileGetModelPath (SeqFileObject, &errorInfo, &processModelPath));
}
}
04-25-2012 06:46 PM
Hello lvrat,
You could use SequenceFile.GetModelAbsolutePath. Once you have the path, you could just parse the name from the last position of the string.
Regards,
Jeff L.