In the FinalBuilder itself there are no problems with $(_abc) and the “Set Variable” action,
but in VBScript such a variable cannot be set.
According to the code completion, there is an FBVariables._abc,
but that’s not true. Luckily there has FBVariables.GetVariable(“_abc”).
But how can this variable to be set?
x = FBVariables._abc ' does not compile, error message see below
x = FBVariables.GetVariable("_abc")
Error Executing script : BeforeAction
Compilation error in Microsoft VBScript
invalid symbol
Line: 2
Char : 18
Error in BeforeScript : VBScript, This Action did not execute.
My attempts (can’t find anything else in the code completion, nor anything in the forum or google)
FBVariables._abc = x
FBVariables.GetVariable("_abc") = x
FBVariables.SetVariable("_abc", x)
FBVariables.SetVariable "_abc", x
Action.EnvironmentVariables.Values("_abc") = x ' this does work, but only for current MSBuild-Action
The codes with FBVariables.GetVariable and FBVariables._abc, in a function in GlobalScript, the execution also breaks off without an error message.
No error message apart from
Error in BeforeScript : VBScript, This Action did not execute.
First thought it was due to SkipAction and had been looking there for ages.
The VBScript language does not allow ‘special’ characters in variables.
This works for me
dim x
Action.SetVariable "_test", "abc"
x = FBVariables.GetVariable("_test")
alert(x)
Not sure why we don’t have Action.GetVariable - we should since actions can implement their own variable namespace (only a few actions do that, like the group). The good news is FBVariables does expose variables via the Action’s variable namespace. Likewise we probably should have FBVariables.SetVariable for consistency.
Unfortunately, Action.SetVariable only sets the variable within the action.
After the action, the variable has its old value again. This is somewhat unfavorable, since the value should be used for many subsequent actions.
I found a preliminary “solution” → a second variable _test as macro with %dummy_test% dummy_test for write access in VBScript
Crap, it works in your script.
I was hoping it was because the SetVariable was in a function in ProjectGlobalScript, but unfortunately your script works with that too.