|
#1
|
|||
|
|||
Can Jscript and VBScript co-exist
I have a fairly large build script. The default language is VBS and everything is written in VBS. I have a need to utilize functionality that is in js and not vbs. Is there a way to make them co-exist? The location where I need it is inside of a step that has a TON of vbs that i wouldn't want to rewrite.
|
#2
|
|||
|
|||
Other than Run Script steps, all other step script code (script events, script expressions, etc.) must use the default script language. You might be able to get away with dynamically changing the default script language mid-build.
|
#3
|
|||
|
|||
Is there a way to call another step from within a step? Or maybe a custom action? We could always embed the js inside of another step or action.
|
#4
|
|||
|
|||
Below is a sample Run Script vbscript that creates a new project with a single Run Script (jscript) step, which retrieves the computer name with jscript, which the VBScript "uses". This is derived from the Script.bld sample.
Code:
jscript = "var cname = new ActiveXObject('WScript.Network').ComputerName;" & vbcrlf & _ "Application.Macros(vbldMacroProject).Add('CNAME', cname);" val = RunJScript(jscript, "CNAME") msgbox val Function RunJScript(script, macroName) Dim objApp, objBld, objStep ' create VisBuildPro app and build objects and connect Set objBld = CreateObject("VisBuildSvr6.Builder") Set objApp = CreateObject("VisBuildSvr6.Application") objBld.Initialize objApp ' create an empty LOGFILE macro to disable logging of the ' temporary project objApp.Project.Macros.Add "LOGFILE", "" ' create a project that creates a file ' add a write File step and set its properties Set objStep = objApp.Project.Steps(vbldStepMain).Add("Run Script") objStep.Name = "Run JScript" objStep.Indent = 0 objStep.Property("Language") = "JScript" objStep.Property("Script") = script ' build the dynamic project if objBld.SyncBuild() = vbldBuildCompDone Then RunJScript = objApp.Project.Macros(macroName).Value Else builder.LogMessage "Error in script" step.BuildStatus = vbdStepStatFailed End If End Function |
Thread Tools | |
Display Modes | Rate This Thread |
|
|