Referencing external scripts in VB6 (similar to hta)

Posted on 2008-11-16
Last Modified: 2012-05-05
Apologies for the title, let me explain:
I am designing a slightly prettier front-end naming system for WinPE/SCCM. I am looking at doing this in VB6.  The script I am recreating is attached. What I would like to know is how I reference "X:\ZTIUtility.vbs" as below within VB6? Without reference to this script, the environment vars aren't passed during the build.
Thank you
<job id="ZTIPromptForComputerName">

   <script language="VBScript" src="X:\ZTIUtility.vbs"/>

   <script language="VBScript">

Option Explicit

Dim numCount

Dim strComputerName

Dim strComputerOU

Dim objOSD

Do While numCount = 0

    strComputerName = InputBox ("Please enter a name for the new computer:","New Computer Name","",10,10)

    If strComputerName = "" Then

        Wscript.Echo "You must enter a computer name."


        oEnvironment.Item("OSDNEWMACHINENAME") = strComputerName

        oEnvironment.Item("OSDCOMPUTERNAME") = strComputerName

        Exit Do

    End If


Do While numCount = 0

    strComputerOU = InputBox ("Please enter OU for the new computer:","COMPUTER OU","",10,10)

    If strComputerOU = "" Then

        Wscript.Echo "You must enter an OU name."


        oEnvironment.Item("MACHINEOBJECTOU") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"

	oEnvironment.Item("OSDDomainOUName") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"

	oEnvironment.Item("OSDJoinDomainOUName") = "OU=" & strComputerOU & ",OU=CaroeCourt Computers,DC=CaroeCourt,DC=Net"

        Exit Do

    End If




Open in new window

Question by:NewsInternationalLtd
    LVL 14

    Expert Comment

    Have a look at this article    it might give some help towards the MSScriptcontrol

    Author Comment

    Still not clear on this.
    Should I add the vbscript as an object?
    LVL 14

    Expert Comment

    I believe that you would instantiate the msscriptcontrol object and then add the vbscript text into that control to be able to execute it.  I do not know if you will be able to pull variables and the like into your vb6 program.  this just allows running vbs scripts.  

    Accepted Solution

    I have re-written this as an HTA which now works fine. I don't think WinPE works properly with vb6.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now