03-01-2012 01:32 AM
Hi all,
I try to add Label in Main sequence, but problem is how to refer there. Successfully were done subsequences and their content, but now want to add content in main sequence (labels, SequenceCall, Statement etc). Can you someone help me with this code ? (CVI/LabWidows). This code in intended to add Label (szName) into Main sequence.
Before entering Label, need to refered to Main in Sequence file. This part missing.
tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep)); tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName)); error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);
I've tryed with TS_SeqContextGetMain(), but does not work.
Best regards,
branar
Solved! Go to Solution.
03-01-2012 01:47 AM
The part you are missing is the Sequence.
You have a handle to a SequenceFile, now you need is a Sequence either by add a new sequence using Engine.NewSequence then doing an Insert. Or using SequenceFile.GetSequence. Seeing you have the SequenceFile you want to use the GetSequence method.
03-01-2012 02:49 AM
Hi Ray,
Still does not work. I've tried first to add Sequence, but it was add subsequence (not is MainSequence)
tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); // tsErrChkMsgPopup( TS_EngineNewSequence (EngineHandle, &errorInfo, &newSequence)); // tsErrChkMsgPopup(TS_SequenceSetName (newSequence, NULL, "Main")); // tsErrChkMsgPopup( TS_SeqFileInsertSequence (SequenceFileHandle, &errorInfo, newSequence)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep)); tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName)); error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);
After that, I was tried with:
tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); tsErrChkMsgPopup( TS_SeqFileGetSequence (SequenceFileHandle, &errorInfo, 0, &Sequence)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "","Label",&labelStep)); tsErrChkMsgPopup( TS_StepSetName (labelStep, &errorInfo, szName)); error = TS_SequenceInsertStep (SequenceFileHandle, &errorInfo, labelStep, indexL, TS_StepGroup_Main);
Problem is probably in defining seq. file's MainSequence. So, I use two files (one default where i get normal subsequencies, and second (target), created with new formed subsequencies and default file. New subsequencies are copied into a target file. Adding context in MainSequence seems to be problematically, at least for me. I want first to "fulfill" mainSequence (trying to get code for this) and after that rest of subsequences and default context. My code currently create subsequences and their context succesfully.
best regards,
branara
03-01-2012 06:07 AM
If you create a new sequencefile, it will already have a MainSequence by default and it will be the first element in an array of Sequences so you dont have to Insert a sequence called "MainSequence".
03-01-2012 06:12 AM
Also,
when you insert the step into the sequence you appear to be using the SequenceFile reference rather than the Sequence reference.
You insert steps into a sequence not a sequence file.
03-02-2012 05:13 AM
Hi Ray,
reason why is used SecuenceFileHandle was that I modify existing file (not creating new one). Simply, add subsequences to default file and save as different name. Problem is now solved by
TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle)
I search for "MainSequence" and adding stuffs there. Previously, MainSequence was created and two sequence with same name were existi.
best regards,
branara