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 05-20-2004, 04:16 PM
pcts pcts is online now
Registered User
 
Join Date: 05-20-2004
Posts: 1
Unhappy Macro no eval properly in script

Suppose I have the following macros and their respective values:

MACRO1 = "58" (temporary macro)
MACRO2 = "Hello There %MACRO1%" (project macro)

When I hover the mouse over MACRO2 on the Macros tab, I correctly see a tooltip with the value "Hello There 58".

However, if I I try to access MACRO2 in a script step, I get the value "Hello There %MACRO1%", even though MACRO1 does have a value.

For example:
Set macrosProject = Application.Macros(vbldMacroProject)
Set macro2 = macrosProject.Item("MACRO2")
builder.LogMessage "Value is " & macro2.value

And I get
Value is Hello There %MACRO1%

Any idea what's going on?
Reply With Quote
  #2  
Old 05-20-2004, 04:50 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
By design, the macro object's Value property returns the raw (unexpanded) value of the macro. To retrieve the expanded value, use:

Application.ExpandMacros("%MACRO2%")
-or-
Application.ExpandMacros(macro.Value)

or if the macro value might also contain script expression(s), use ExpandMacrosAndScript instead of ExpandMacros.
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 03:10 AM.


Copyright © 1999-2023 Kinook Software, Inc.