![]() |
Macro containing brackets
1 Attachment(s)
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. Code:
Approach 2: Use Application.ExpandMacros Code:
Approach 3: Double percentage Code:
Approach 4: use vbld_AllMacros() Code:
Funny: Message box is ok Code:
Approach 5: doubling the brackets once Code:
Funny: with a message box, it works, but replacement is not done. Steps 1, 2, 3, 4, 6 fail. Steps 5, 7, 8 with message boxes are successful (but replacements are not made). |
I forgot the version number
I am using Visual Build 7.5b.
|
1 Attachment(s)
If the program's output contained
[System Process] the output macro (i.e., LASTSTEP_OUTPUT) should contain the text with the brackets double (escaped) like [[System Process]] See the attached sample. |
Thank you
Thank you. As I am saving the process list in a macro, I now use the Set Macro build step and I assign the value
Code:
[Replace(Replace(vbld_AllMacros()("LASTSTEP_OUTPUT").Value,"[[","[[[["), "]]", "]]]]")] |
You could also use vbld_EscapeString when assigning your macro value.
http://www.kinook.com/VisBuildPro/Ma...scriptmisc.htm |
All times are GMT -5. The time now is 02:51 AM. |
Copyright © 1999-2023 Kinook Software, Inc.