PDA

View Full Version : Laststep_output


HippyCraig
02-20-2008, 03:30 PM
I have a script action and when I try to assign the value of LASTSTEP_OUT to a variable I get errors.

output = Application.ExpandMacrosAndScript("%LASTSTEP_OUTPUT%")

What can I do the out put looks like the following:

Error in Run Script (VBScript) script code at Line 3, Column 78 (Unterminated string constant)
Code: output = Application.ExpandMacrosAndScript("Building list for $/BHWeb........



It appears that the Macro is expanded before being assigned to the variable. Please note that the variable contains quotes which would be perferable to have them.

kinook
02-20-2008, 03:35 PM
output = Application.ExpandMacrosAndScript("%%LASTSTEP_OUTPUT%%")

http://www.visualbuild.com/Manual/runscript.htm

HippyCraig
02-20-2008, 04:07 PM
It works now thanks for the quick response!!!!

HippyCraig
02-26-2008, 09:49 AM
I have a few other questions relates to this. The following works in a script Step

strAppName = Application.ExpandMacrosAndScript("%%TMP_APP_NAME%%")

strSearchString = Application.ExpandMacrosAndScript("%%LASTSTEP_OUTPUT%%")

But if I add the same lines to a actions Sub vbld_StepDone() function the value returned is the following

strAppName = "%TMP_APP_NAME%"

Why would this code work in a Script action and not in a StepDone script.

kinook
02-26-2008, 01:57 PM
Because macro references (i.e., %ABC%) are expanded before processing the code in a Run Script step, but not for script events and script functions (code in the Script Editor). So you don't need to double the percents for code in the Script Editor.

http://www.visualbuild.com/Manual/scripteditor.htm

HippyCraig
02-26-2008, 03:21 PM
Thanks, I am now using the Set object to macro functions in both situations based on the info you sent me.

This is just a sample:

Dim objAppName, objSearchString

'Set varibles
Set objAppName = Application.Macros(vbldMacroTemporary).Item("TMP_APP_NAME")
Set objSearchString = Application.Macros(vbldMacroSystem).Item("LASTSTEP_OUTPUT")

'Search through last output.
If InStr(1,UCase(objSearchString.Value), UCase(objAppName.Value)) > 0 Then
Application.Macros(vbldMacroTemporary).add "TMP_UNINSTALL_CHECK", "TRUE"
End If

This seems to work in both script actions and events, unless theres something Im missing.

kinook
02-26-2008, 03:25 PM
That will be fine if you know the type of macro you need and don't need macros, script, special characters, etc. within the macro value evaluated/expanded.

HippyCraig
02-26-2008, 04:05 PM
Can you give an example of special charaters as CR, Linefeeds, Quotes and such do exist. Othere then that I undstand that if I have a macro or script in the value it will not be evaluated in this manner.

kinook
02-26-2008, 04:09 PM
By special chars I mean special to VBP (% [ ]): http://www.visualbuild.com/Manual/specialchars.htm

These will be escaped (doubled) by VBP in LASTSTEP_OUTPUT, for instance, and will come through to your code still doubled if the raw macro value is accessed instead of expanding.

HippyCraig
02-26-2008, 04:24 PM
Great thanks for the help. In my current situation its only reading through the output for version information from VSS and checking if software is installed on a server.

But I see what you are talking about and will use the other if Im evalating scripts or macros.

Thanks for clearing that up.