Return to calling VBS from HTA
Posted on 2008-10-16
Well....it looks like it's my turn to ask a question - WooHoo! :o)
I am developing a method for our imaging that PXE boots to WinPE, launches a VBScript to run wpeinit, map a drive and call up an HTA where you can select an image to apply to the workstation. All this works fine, the HTA runs, my choices are captured via radio buttons and checkboxes and Ghost32 is run with the proper commandline switches.
The issue I'm having is when the Ghost client finishes, it closes then the HTA closes - which *should* return control to the originating VBScript to execute the next line in the script. However....the calling script throws an error:
Start.vbs (37, 1) (null): The operation was canceled by the user.
Now, I've started the HTA using several methods - objShell.Run "x:\windows\system32\mshta.exe s:\scripts\menu.hta",3,True - seems at least wait for something to happen with the HTA (either a Self.Close, Window.Close or killing the mshta process) before continuing, but the error above happens no matter what method I use to exit the HTA.
I have other things in the calling script that execute, wait and then continue after completion just fine. It's only this return from the HTA that has greatly reduced the existence of hair on my head.
Is there any method at all I can leverage short of including the VBScript I need to launch after the HTA closes within the HTA itself? I don't like that last idea given how I have to maintain things.
Code gurus, I'm all ears ('cause I have no more hair)!! LOL.