Run HTA file from Script

Has anyone had success with running a HTA file within a script to create a prompt for a user?

I do know there is "E3.Tools.IODialog" and "E3.Tools.ListBoxDialog" but I would like to have combination of check boxes and drop down menus.

Thanks in Advanced,

Mike M.

0

Comments

3 comments
  • I've never tried calling an HTA within a script. How would that work?

    Not 100% sure but I believe that you can mix controls with the E3.Tools. There's an example VBSForms script.

    The other alternative to E3.Tools would be creating a Windows form. I think that would be easier than trying to come up with something in E3.Tools.

  • So this is the first time I've worked with and tried to use HTA files but the follow snippet of code allows me to call the HTA when I use the debug tool within VbsEdit.  The HTA launches and I'm able to work with the HTA, close the window, and the script finishes without any errors.

    Const SHOW_ACTIVE_APP = 1 
    Set objShell = CreateObject("Wscript.Shell") 
    objShell.Run ("HTA_test.hta"), SHOW_ACTIVE_APP, True 

     

    However, when I run the script from Zuken the script runs until the above lines of code, never launches the HTA, and does not complete the script. 

    So I'm wondering if Zuken isn't capable of handling a Wscript.Shell object?  or am I missing something else?

    Thanks,

    Mike M.

  • Hi Guys,

     

    I used to use an HTA all the time years ago, but I moved away from it when we started getting a lot of virus scanners going after the web browsers.

    Here is a snippet I created:

    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")

    Dim ExecuteLine
    ExecuteLine = "MyTool.hta"

     If Not run_command(ExecuteLine) Then
        MsgBox "Error: ??"
        Wscript.quit
     End If

    Function run_command(CommandLine)
        On Error Resume Next
        Run_command = WshShell.Run(CommandLine,,True)
        If Err Then
           ShowError "Cannot run command '" & CommandLine & "'"
           Run_command = Err
        End If
    End Function

    Should be pretty close.

     

    Regards,

     

    Paul

Please sign in to leave a comment.

Didn't find what you were looking for?

New post