running an hta from another hta

Hi,

I have two HTAs. One that is run automatically and the other that should be opened by clicking a link in the first HTA.

When I put it a regular link (<a href...) it notifies on a security issue. To workaround this issue I did the following:

1. Created a Wshell script that will run the hta.

Sub OpenHTA(link)

set wshell=createobject("Wscript.shell")

wshell.run("mshta.exe " & link)

End Sub

2. In the link i created an Onclick event handler that calls the subroutine I created above.

Unforyunately, it creates an mshta.exe process but the hta itself does not display.

Any idea how to resolve this

By the way, I did the same thing to run a .chm file and it works fine.



Answer this question

running an hta from another hta

  • Deza

    I have had success in opening an HTA with all of the following strings:

    (JScript)
    new ActiveXObject("WScript.Shell").Run("mshta U:\\hw.hta");

    new ActiveXObject("WScript.Shell").Run("U:\\hw.hta");

    new ActiveXObject("WScript.Shell").Exec("mshta U:\\hw.hta");

    new ActiveXObject("WScript.Shell").Exec("%comspec% /C \"U:\\hw.hta\"");

    new ActiveXObject("WScript.Shell").Exec("%comspec% /C mshta \"U:\\hw.hta\"");

    new ActiveXObject("WScript.Shell").Run("%comspec% /C mshta \"U:\\hw.hta\"");

    new ActiveXObject("WScript.Shell").Run("%comspec% /C \"U:\\hw.hta\"");

    Of course, in VBScript
     they would each be CreateObject("WScript.Shell").Run("mshta.... etc")


  • running an hta from another hta