Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-16-2007, 04:19 PM
BrandonG BrandonG is online now
Registered User
 
Join Date: 11-13-2006
Posts: 12
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.
Reply With Quote
  #2  
Old 08-16-2007, 05:00 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #3  
Old 08-17-2007, 10:14 AM
BrandonG BrandonG is online now
Registered User
 
Join Date: 11-13-2006
Posts: 12
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.
Reply With Quote
  #4  
Old 08-17-2007, 02:51 PM
kevina kevina is online now
Registered User
 
Join Date: 03-27-2003
Posts: 825
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 08:58 AM.


Copyright © 1999-2023 Kinook Software, Inc.