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 02-13-2004, 11:55 AM
ukemigrant ukemigrant is online now
Registered User
 
Join Date: 02-13-2004
Posts: 2
Can't get DATETIME macro value

Hi folks, in a script step, I'm assigning the DATETIME macro value as follows:

macro.Value = [DATETIME]

but I get nothing in the relevant macro. If I replace this with:

macro.Value = [DATE]

I get the macro value coming back properly with the relevant date. If I look in the system macros list, I can clearly see the DATETIME macro there.

There's no hint of any errors and I've searched the forums here with no luck. I could write a funtion to get the date/time or use the Format...VSS function I came across in another thread, but this seems to be a fundamental thing which should work.

Anyone have any ideas? I'm using version 5.0 of Visual Build, running on w2k.

Thanks in advance.

Sam.
Reply With Quote
  #2  
Old 02-13-2004, 02:09 PM
kevina kevina is online now
Registered User
 
Join Date: 03-27-2003
Posts: 825
The problem you are encountering is that the DATETIME macro contains a space, and you aren't quoting the macro value in the assignment.

Something like this will work better:
Application.Macros(vbldMacroTemporary).Add "TEST_DATETIME", "%DATETIME%"

Note: using .Add will ensure the macro exists with the value specified, creating if necessary

Kevin
Reply With Quote
  #3  
Old 02-13-2004, 03:05 PM
ukemigrant ukemigrant is online now
Registered User
 
Join Date: 02-13-2004
Posts: 2
Quote:
Originally posted by kevina
The problem you are encountering is that the DATETIME macro contains a space, and you aren't quoting the macro value in the assignment.

Something like this will work better:
Application.Macros(vbldMacroTemporary).Add "TEST_DATETIME", "%DATETIME%"

Note: using .Add will ensure the macro exists with the value specified, creating if necessary

Kevin
Thanks Kevin but for some reason that did not work either - I tried something like that.

This works though:

Application.Macros(vbldProject).Add strMacroName, Application.Macros(vbldSystem).Item("DATETIME").Va lue

Cheers, Sam.
Reply With Quote
  #4  
Old 02-13-2004, 06:13 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Text within brackets in a VBP step field indicates a script expression to be evaluated. So [DATETIME] evaluates to nothing in VBScript and [DATE] evaluates to the VBScript Date function (which btw will evaluate to the same value as the VBP DATE system macro).

Values between percents in a field indicate the name of a macro to be evaluated. So %DATE% or %DATETIME% will return the corresponding system macro values for those macros. This applies for all fields on most step properties (including the Script code field of the Run Script action).

However, brackets and percent do not have any special meaning in the Script Editor (project scripts, global scripts, etc.), so you would need to use the method you described, or if the macro/script may itself reference other macros or script use:

Application.ExpandMacrosAndScript("%DATETIME%")
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 07:28 PM.


Copyright © 1999-2023 Kinook Software, Inc.