#1
|
|||
|
|||
Macro containing brackets
I have recorded the output of a build step (namely the VMWare list processes action). The output of this step contains brackets for one of the processes ([System process]) and is multiline (one process per line).
I would like to check whether a specific process is running, so I perform additional operations on the macro value. However, I can't get it work. In this simplified example I am looking for svchost in the list of running processes. Instead of a temporarily assigned macro I use a fixed project macro to reproduce. Code:
Approach 1: Simply use the Instr() VBScript function. [Instr(1, "%VMPROCESSES%", "svchost")] Code:
Approach 2: Use Application.ExpandMacros [Application.ExpandMacros("%VMPROCESSES%")] Code:
Approach 3: Double percentage [Application.ExpandMacros("%%VMPROCESSES%%")] Code:
Approach 4: use vbld_AllMacros() [vbld_AllMacros()("VMPROCESSES").Value] Code:
Funny: Message box is ok [msgbox (vbld_AllMacros()("VMPROCESSES").Value)] Code:
Approach 5: doubling the brackets once [Replace(Replace((vbld_AllMacros()("VMPROCESSES").Value), "[[", "[[[["), "]]", "]]]]")] Code:
Funny: with a message box, it works, but replacement is not done. [msgbox (Replace(Replace((vbld_AllMacros()("VMPROCESSES").Value), "[[", "[[[["), "]]", "]]]]"))] Steps 1, 2, 3, 4, 6 fail. Steps 5, 7, 8 with message boxes are successful (but replacements are not made). |
|
|