PDA

View Full Version : Removing line returns in Visual Build


feiock
02-10-2004, 04:53 PM
In my failure step, I call a VBscript where I pass the system macro
%LASTSTEP_OUTPUT%. Unfortuneatly some 3rd party apps we use put line returns in their error messages. This causes the string that is in %LASTSTEP_OUTPUT% to also contain these line returns. So then when my script is called, it is not able to accept the parameters correctly. Has anyone else come across this issue, and what did you do to get around it?

Thanks

pjaquiery
02-10-2004, 05:34 PM
VBP gets a bit bent and twisted if you expand macros containing line ends because it tries to parse the expanded text and fails.

Use [vbld_AllMacros().Item("LASTSTEP_OUTPUT").Value] to insert the text instead.

I encounter this problem so much that I have a JScript function to do the job:

function GetStr (macroName)
{
var macro = Application.FindMacro (macroName);
if (macro == null)
return "";

return Application.ExpandMacros (macro);
}

so I would use [GetStr ("LASTSTEP_OUTPUT")].

feiock
02-10-2004, 06:01 PM
I am pretty new to this product, so you might have to provide me with a little more detail. It looks like you are assigning the value of the macro directly to a variable inside your script...is this correct? If so, I guess you need some sort of add-in to tie Visual Build to the VB Script, because when I try it, it has no idea what I am trying to do. Also, I am running the regular version of VisBuild, not professional.

Thanks