Results 1 to 7 of 7

Thread: Dynamically creating a form and control in a VBscript

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    San Jose, CA
    Posts
    66

    Dynamically creating a form and control in a VBscript

    I need to create a VBscript which has 1 form, and at least one control.
    I want to prompt the use to change the drive letter.

    So I need a form, and a Dir List Box.

    However, I don't know how to add a form or control to a vbscript, since it seems to be limited to variant data types only.

    I will initially do this in a VB6 program, so I can see what properties need to have default values set, then move it over to a VBScript. It's also much easier to develop and debug in VB6 than in VBScript.


    Would someone who has actually done this in VBScript, please point me to an example of adding a form & control in a vbscript? Unfortunatley, It's not quite the same as working in regular VB.

    thanks

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Dynamically creating a form and control in a VBscript

    The only thing visual you have access to in VBScript is Server.CreateObject("SomeProject.SomeVisualComponent")

    In what environment will this VBScript be executed? ie.. command-line, ASP page from IIS?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    San Jose, CA
    Posts
    66

    Re: Dynamically creating a form and control in a VBscript

    Quote Originally Posted by Dave Sell
    The only thing visual you have access to in VBScript is Server.CreateObject("SomeProject.SomeVisualComponent")

    In what environment will this VBScript be executed? ie.. command-line, ASP page from IIS?
    It will be executed from an Install Shield installer.
    I've got one example that shows a Session object, but I would rather put up aVBform (not an HTML form), with a DirListbox (or similar) on it.
    Unfortunately, I can only find articles about web-based vbscript examples.


    im pth
    dim drv
    'The following statement displays the path from which setup is run
    'MsgBox session.property("SETUPEXEDIR")

    'Store this value in a variable
    pth = session.property("SETUPEXEDIR")

    'extract the first 2 characters of the path that stands for the drive
    drv = Left(pth,2)

    'Assign the drive to be the installation drive and also add subdirectories if you wish
    session.property("INSTALLDIR") = drv + "\NameADir"

  4. #4
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Dynamically creating a form and control in a VBscript

    Well, then, my idea won't work. I was going to suggest you to make your own ActiveX Control, and register it with the system, and then call Server.CreateObject() on your custom Object.

    However this won't work in the context of an installer, as the machine in question doesn't have your stuff installed on it yet...
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    San Jose, CA
    Posts
    66

    Re: Dynamically creating a form and control in a VBscript

    Quote Originally Posted by Dave Sell
    Well, then, my idea won't work. I was going to suggest you to make your own ActiveX Control, and register it with the system, and then call Server.CreateObject() on your custom Object.

    However this won't work in the context of an installer, as the machine in question doesn't have your stuff installed on it yet...

    Actually, I believe it will. THe above suggestion came from the tech support at Install Shield. The vbscript only has to prove the user with a choice to select a drive letter, then send this back to the installer, so the installation drive will get changed. Once it's changed, the installer will copy the files to the new location.
    The installer is equipped to execute EXE, DLL, or VBscripts at various point during installation. It's unfortunate, I can't access the Session object from a VB6 executable. I don't know where the object comes from, but it's accessible in VBscript

  6. #6
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Dynamically creating a form and control in a VBscript

    Well, the reason I beleive my suggestion wont work is because such an object has to be registered with the system before you use it. I dont use install shield, so I dont know if you can register an object that is part of the install package, and use it at the same time you are trying to complete the rest of the installation.

    If you do have that ability, then you could make your own visual object which can return a value to the installer.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  7. #7
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Okinawa, Japan
    Posts
    271

    Re: Dynamically creating a form and control in a VBscript

    cappy2112,

    If im understanding you correctly, couldnt you use BrowseForFolder???
    Example
    VB Code:
    1. Set BFF=CreateObject("Uncommon.BrowseForFolder")
    2. BFF.Title="Choose installation directory."
    3. BFF.FLAGS=&H10
    4. BFF.InitialFolder="c:\"
    5. BFF.ShowModal(0)
    6. MsgBox BFF.Path

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width