|
#1
|
|||
|
|||
Jscript examples
Anyone have examples on how to manipulate macros using jscript? I have tried using the application object without success. As I have found, jscript examples are hard to come by in vbp.
Thanks |
#2
|
|||
|
|||
I use JScript all the time.
// Add a temporary macro Application.Macros (0).Add ("EmailSuccess", success); // Return the contents of a macro as a string function GetStr (macroName) { var macro = Application.FindMacro (macroName); if (macro == null) return ""; return Application.ExpandMacros (macro); } // Load temporary macros from a file var filename = "all.macros"; Application.Macros(0).Load (filename, false); // Remove a temporary macro Application.Macros (0).Remove ("ArchiveTimeStamp"); // Copy last step status to temporary macros function SaveLast () { tempMacros = Application.Macros (0); sysMacros = Application.Macros (3); tempMacros.Add ("SavedResult", sysMacros.item ("LASTSTEP_STATUS").value); tempMacros.Add ("SavedOutput", sysMacros.item ("LASTSTEP_OUTPUT").value); } |
#3
|
|||
|
|||
A good place to look for jscript examples is the system script provided with Visual Build Professional itself (all the same script functions, etc that are provided in vbscript are also available as jscript). Several methods add or use macro values, such as: vbld_AddDelimValue, vbld_NextDelimValue, etc.
Just go to the script editor and change the language to jscript and look at the script under the System tab. You can also compare against vbscript (or PerlScript) by changing the language back and forth... |
#4
|
|||
|
|||
Thanks for all the information. I appreciate it very much.
|
|
|