11-06-2015 02:49 AM
Hi,
Using Teststand C++ API, I would like to add a sequence file to the current project in the current workspace.
My sequence file has been created using engine->NewSequenceFile(); and saved in the path "Path" (as std::string).
I try to create a new workspace file this way :
engine->CurrentWorkspaceFile->GetRootWorkspaceObject()->NewFile( _com_util::ConvertStringToBSTR(Path.c_str()) );
But this line throw a com exception "Unknown error 0xFFFFBC63" which should correspond to error -17309
What is the correct way to do this ?
Thank you.
11-09-2015 05:16 AM
hello
Could you provide the code you're using, for example the order of functions you're calling?
So that we could look closer at your project.
Thanks
Regards
11-09-2015 07:09 AM
Thank you for your answer.
Here the code I'm using :
string newSeqName = "myNewSequence";
TS::SequenceFilePtr newSeqFile = _currentContext.engine->NewSequenceFile();
TS::WorkspaceObjectPtr workspacePtr = _currentContext.engine->CurrentWorkspaceFile->GetRootWorkspaceObject();
string chapterPath = getFolderFromFilePath(string(workspacePtr->GetPath())) + "\\";
chapterPath += newSeqName + ".seq";
try
{
newSeqFile->Save(chapterPath.c_str());
} catch (_com_error const & e) {
gcLogModuleError("Error on save : %s", e.ErrorMessage());
}
TS::WorkspaceObjectPtr newSeqObj;
try {
newSeqObj = workspacePtr->NewFile( _com_util::ConvertStringToBSTR(chapterPath.c_str()) );
} catch (_com_error const & e) {
gcLogModuleError("got error on newfile : %s ", e.ErrorMessage());
}
workspacePtr->InsertObject(newSeqObj, workspacePtr->NumContainedObjects);
_currentContext.engine->CurrentWorkspaceFile->AsPropertyObjectFile()->IncChangeCount();
_currentContext.engine->ReleaseSequenceFile(newSeqFile);
_currentContext.engine->SaveAllModifiedSeqFiles(0);
this code saves in the right place my file "NewSequence.seq"
Generate error TS_Err_IllegalOperationOnValue
11-09-2015 10:49 AM
Hello,
Looking at your code, the way to script TestStand is to - create a workspace, the create a project then create a sequence. It doesn't appear in your code that you create a project.
Please could you try this using the Workspace.Objectfile.Newfile(path du projet)? The project file extension is .tpj.
Thanks
11-10-2015 03:05 AM
Hello,
I want to add a sequence to the current project of the current workspace but GetProjectFile() always give me an invalid pointer in :
_currentContext.engine->CurrentWorkspaceFile->RootWorkspaceObject->GetProjectFile()
If I create a new project, I don't see how to add a sequence to it once I got my TS::WorkspaceObjectPtr.
Is there documentation/example on this subject ?
Thank you.