Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-20-2008, 03:30 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
Laststep_output

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_OUTPU T%")

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.
Reply With Quote
  #2  
Old 02-20-2008, 03:35 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
output = Application.ExpandMacrosAndScript("%%LASTSTEP_OUTP UT%%")

http://www.visualbuild.com/Manual/runscript.htm
Reply With Quote
  #3  
Old 02-20-2008, 04:07 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
It works now thanks for the quick response!!!!
Reply With Quote
  #4  
Old 02-26-2008, 09:49 AM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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_OUTP UT%%")

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.
Reply With Quote
  #5  
Old 02-26-2008, 01:57 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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
Reply With Quote
  #6  
Old 02-26-2008, 03:21 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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_A PP_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.
Reply With Quote
  #7  
Old 02-26-2008, 03:25 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #8  
Old 02-26-2008, 04:05 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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.
Reply With Quote
  #9  
Old 02-26-2008, 04:09 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #10  
Old 02-26-2008, 04:24 PM
HippyCraig HippyCraig is offline
Registered User
 
Join Date: 07-27-2006
Location: Philly
Posts: 211
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 08:19 PM.


Copyright © 1999-2023 Kinook Software, Inc.