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)
-   -   Jscript examples (https://www.kinook.com/Forum/showthread.php?t=969)

bdsst7 03-23-2005 10:27 PM

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

pjaquiery 03-23-2005 10:48 PM

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);
}

kevina 03-23-2005 10:50 PM

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...

bdsst7 03-23-2005 10:52 PM

Thanks for all the information. I appreciate it very much.


All times are GMT -5. The time now is 01:05 PM.


Copyright © 1999-2023 Kinook Software, Inc.