Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Using defined macros in a VBScript (https://www.kinook.com/Forum/showthread.php?t=4334)

ChrisF 12-16-2009 10:41 AM

Using defined macros in a VBScript
 
I'm using VBPro v7.2

I set up macros to start my script, for example

macro name = PROJECT_DIR
macro value = C:\My Projects

I can then use the macroin subsequent steps, like copying files, for example

source dir = %PROJECT_DIR%\source

But now I want to use the macro in a step that has a VBScript, and the macro NEEDS to be inside quotes. So without the macro, I do

dbFile = "C:\My Projects\myFile.db"

How can I do the equivalent of this instead?

dbFile = "%PROJECT_DIR%\myFile.db"

kinook 12-16-2009 10:59 AM

Within a Run Script step, you can reference it just like that. If the code is in project/global script (View | Other Windows | Script Editor), use

dbFile = Application.ExpandMacrosAndScript("%PROJECT_DIR%") & "\myFile.db"

http://www.kinook.com/VisBuildPro/Manual/runscript.htm
http://www.kinook.com/VisBuildPro/Ma...ripteditor.htm

ChrisF 12-16-2009 02:51 PM

Thanks, this worked like a charm!


All times are GMT -5. The time now is 11:06 AM.


Copyright © 1999-2023 Kinook Software, Inc.