Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-20-2006, 05:08 PM
jkeffer jkeffer is online now
Registered User
 
Join Date: 12-01-2006
Posts: 3
Upgrading from 5.7 to 6.2a and Nested Macros

I'm attempting to upgrade from version 5.7 to version 6.2a and I'm having a problem with nested macros. I have the following:

%%["TESTPCPASSWORD"+"%SHORTNAME%"]%%

Previously, it would evaluate to %TESTPCPASSWORD_<value of SHORTNAME>%, which would then be evaluated. For example, if SHORTNAME evaluated to XYZ, the macro to be evaluated would be %TESTPCPASSWORD_XYZ% which would then be evaluated itself.

I can get to the stage of %TESTPCPASSWORD_XYZ%, but this does not get evaluated.

How do I structure this to get it to work for 6.2a?

Julia
Reply With Quote
  #2  
Old 12-20-2006, 05:37 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
It was actually a bug (in versions prior to 6.2) that %% was not treated as a literal % character when the field also contained a script expression. See here for other ways to achieve this (which work in all versions of VBP):

http://www.kinook.com/Forum/showthre...?threadid=1249
Reply With Quote
  #3  
Old 12-21-2006, 09:56 AM
jkeffer jkeffer is online now
Registered User
 
Join Date: 12-01-2006
Posts: 3
Isn't there an easier way to do this? I use a lot of nested macros in statements in the scripts that look like this:

"%UTILSPATH%\pscp.exe" -q -1 -r -l %%["TESTPCUSERNAME"+"%SHORTNAME%"]%% -pw %%["TESTPCPASSWORD"+"%SHORTNAME%"]%% "%BUILDDIR_RND%\Setup\*" "%%["TESTPC"+"%SHORTNAME%"]%%:%%["TESTPCDIR"+"%SHORTNAME%"]%%"

As you can see, I'm combining the %SHORTNAME% macro with a number of different strings. If I use a solution as suggested, this would look like:

"%UTILSPATH%\pscp.exe" -q -1 -r -l %% [vbld_AllMacros().Item("TESTPCUSERNAME" & vbld_AllMacros().Item("SHORTNAME").Value).Value] -pw [vbld_AllMacros().Item("TESTPCPASSWORD" & vbld_AllMacros().Item("SHORTNAME").Value).Value] "%BUILDDIR_RND%\Setup\*" [vbld_AllMacros().Item("TESTPC" & vbld_AllMacros().Item("SHORTNAME").Value).Value]:[vbld_AllMacros().Item("TESTPCDIR" & vbld_AllMacros().Item("SHORTNAME").Value).Value]

This is not very readable. Creating additional macros to contain the values before using them in a statement like the above defeats the purpose of nesting them in the first place.

Are there any other options?
Reply With Quote
  #4  
Old 12-21-2006, 10:34 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Sure -- create a project or global script function like this:

Code:
Function AppendShortName(macroName)

  AppendShortName = vbld_AllMacros().Item(macroName & vbld_AllMacros().Item("SHORTNAME").Value).Value

End Function
And then use like so:

[AppendShortName("TESTPCUSERNAME")] -pw [AppendShortName("TESTPCPASSWORD")] "%BUILDDIR_RND%\Setup\*" [AppendShortName("TESTPC")]:[AppendShortName("TESTPCDIR" )]
Reply With Quote
Reply


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 10:55 AM.


Copyright © 1999-2023 Kinook Software, Inc.