PDA

View Full Version : Writing macro to file without evaluation


HippyCraig
01-27-2016, 10:19 AM
I have a macro and I set the option "Don't expand Macros or scripts..." Its actually the contents of a file I want to write out, I was using the File Write action and at the time its writing it starts to evaluate the macro, how can I prevent that.

kinook
01-27-2016, 10:36 AM
You can't prevent expansion of macros/scripts within a Write File action. Either escape the file contents when storing in the macro (you can use the Read File (http://kinook.com/VisBuildPro/Manual/readfileaction.htm) action or vbld_GetFileContents (http://kinook.com/VisBuildPro/Manual/sysscriptfile.htm) script function) or use a Run Script action to write the raw macro value (you can use the FileSystemObject (https://msdn.microsoft.com/en-us/library/6kxy1a51%28v=vs.85%29.aspx)).

HippyCraig
01-27-2016, 10:39 AM
how do I write out a macro in a script so its not evaluated? Is there a speciific function to write this marco and not evaluate it?

kinook
01-27-2016, 08:02 PM
Just use the macro's Value (http://kinook.com/VisBuildPro/Manual/macrovalueproperty.htm) property. See the attached sample and log.

HippyCraig
01-28-2016, 08:57 AM
So I guess my concern was around vbld_AllMacros()("ABC").Value, isn't there a function that will write out a macro value with out evaluation of the macro.

kinook
01-28-2016, 09:17 AM
The Value property is the raw macro value. Within a step field, any script or macro references in the text will automatically be expanded (http://kinook.com/VisBuildPro/Manual/specialchars.htm). In script code, you can use Step.ExpProperty (http://kinook.com/VisBuildPro/Manual/expproperty.htm), vbld_StepProp (http://kinook.com/VisBuildPro/Manual/sysscriptmisc.htm), or Application.ExpandMacrosAndScript (http://kinook.com/VisBuildPro/Manual/expandmacrosandscriptfunction.htm) to expand any macros or script in the value.

HippyCraig
01-28-2016, 09:50 AM
Cool thanks for the help