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 06-28-2007, 04:22 PM
ambalboa ambalboa is online now
Registered User
 
Join Date: 06-25-2007
Location: Houston, TX
Posts: 70
How do you pass a value to a macro using vbscript?

I am trying to set a value for a macro using the Run Script action. I know how to pass a value from a macro to a variable, as in:

Set m = vbld_AllMacros()("VER_NUM") or

m = "%VER_NUM%

But now I want to do the opposite. I want (and I'm able) to get the version number of a file, but how do I pass that value to a macro? Let's assume the macro already exist. If the macro already has a version number stored in it, I would like to overwrite it. Does anyone know how to do this? Thanks in advance.
Reply With Quote
  #2  
Old 06-28-2007, 04:29 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
http://www.visualbuild.com/Manual/scriptsample.htm
Reply With Quote
  #3  
Old 07-02-2007, 12:22 PM
ambalboa ambalboa is online now
Registered User
 
Join Date: 06-25-2007
Location: Houston, TX
Posts: 70
Thank you.

I looked at the example and this is what I came up with. I am using two 'Run Script' action steps. The first one gets the version number of a file and set it to the project macro VER_NUM, as shown below.

Set objMacro = Application.Macros(vbldProject).Item("VER_NUM")

objMacro.Value = vbld_FSO.GetFileVersion("path")

The second step gets that number and increments it; both steps are simple.

I have to use two steps because when I check to see if the previous version number was overwritten after the first step is build, the macro still has the old version number. However, I only call the macro on the second step, and it increments it, that being the new retrieved number. Even though the old number is shown after the first step is build, in reality, the new number replaced it, right? Is there a one step delay in this process? Will the new number be displayed on the macros and output pane once a 'Run Script" step using that macro is ran again? Because that's what's happening.

I also combined the two, and now the macro value is updated on the macros pane, but when it logs the message on the output pane, is still displays the old version number. Is there a way around this?

Thank you for your help.
Reply With Quote
  #4  
Old 07-02-2007, 12:30 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The macro is updated immediately; the sample demonstrates retrieving and updating in the same step. You may have a temporary macro with the same name defined, which overrides the project macro value.
http://www.visualbuild.com/Manual/macrostab.htm

Otherwise, please ZIP and send or post:
1) The info from Help | About | Install Info
2) The .bld file demonstrating the problem
3) A build log file

Thanks.
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 06:49 PM.


Copyright © 1999-2023 Kinook Software, Inc.