Kinook Software Forum

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

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-17-2004, 10:53 AM
Sotorin Sotorin is online now
Registered User
 
Join Date: 05-07-2003
Posts: 7
This is what I have tried

Let's simplify things - I have a project w/ two "Run Script" steps. I open up Script Editor, click on Project Tab and type in the followring VBscript:

=============
' these are global variables (w/in the script scope of course)
Dim objXML
Dim var1, var2

Function CreateXMLDoc()
Set objXML = CreateObject("MSXML2.DOMDocument")
If (objXML.Load(<XML file here>)) then
CreateXMLDoc = True
Else
Err.Raise 1, "", "Error loading file"
End If
End Function

Function SetVariables()
If Not (objXML Is Nothing) Then
var1 = objXML.selectSingleNode(<query here>).Text
var2 = objXML.selectSingleNode(<query here>).Text
End If
End Function
=============

Now when my first "Run Script" step calls CreateXMLDoc()everything is OK but when the second step calls SetVariables() then I get an error "Object Required" - evidently objXML went out of scope when CreateXMLDoc finished even though objXML was declared as global variable.

You suggested that I "... modularize the script code into one or more project or global script functions ..." Isn't putting this code under Project Tab (in Script Editor) that very thing? Where would I have to place this code in order for it to be available to all the "Run Script" steps?

I'm insisting on having global access to variables because it is extremely inefficient to load large XML file, change a node, unload for every step that operates on the same XML file and this is the very case in our VisBuild project (multiple steps modify/operate on the same XML file in succession).
Reply With Quote
 


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 05:13 PM.


Copyright © 1999-2023 Kinook Software, Inc.