Forum Discussion
simon_glet
13 years agoRegular Contributor
Hi Steve,
You can't just edit a TC project file to change a project variable value. The variables are not cleary indentified with values easy to read in any of the xml format configuration files.
Like Thomas, we went for the function variable setting option with something like this:
function setProjectVariable(aVariableName, aValue)
{
Log.Message("Before Setting values");
if( ! Project.Variables.VariableExists(aVariableName))
{
Log.Message("Project.Variables." + aVariableName + " does not exist. It will be created");
Project.Variables.AddVariable(aVariableName);
}
Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));
eval("Project.Variables." + aVariableName + "=" + '"' + aValue + '"' + ";");
Log.Message("After Setting values");
Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));
You can't just edit a TC project file to change a project variable value. The variables are not cleary indentified with values easy to read in any of the xml format configuration files.
Like Thomas, we went for the function variable setting option with something like this:
function setProjectVariable(aVariableName, aValue)
{
Log.Message("Before Setting values");
if( ! Project.Variables.VariableExists(aVariableName))
{
Log.Message("Project.Variables." + aVariableName + " does not exist. It will be created");
Project.Variables.AddVariable(aVariableName);
}
Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));
eval("Project.Variables." + aVariableName + "=" + '"' + aValue + '"' + ";");
Log.Message("After Setting values");
Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));
}
Sincerely