question on: HTA and format to include external script file



Noticed when playing with HTA that this:

<SCRIPT Language="VBScript" src="testinc.vbs"/>

caused problems but this:

<SCRIPT Language="VBScript" src="testinc.vbs"></script>

did not?

specifics on the problem one:
the include file *is* still included and I can call procedures from it from
within the main HTA's <script> section but I can't call procedures that are
actually defined *in* the main HTA's <script> section? error is: Type
Mismatch: 'procedurename'. Obviously 'procedurename' is the name of the
function or sub being called.

1. wanted to confirm this is by design and I don't need an update or
something?

2. is this specific to HTA's? or is it the same when using scripts in
regular web pages?

3. general enlightenment on this is greatly desired.

here is example of what I'm talking about. In the code below when the hta is
opened the Window_Onload procedure is not run, no error, and when you click
the button which simply calls the Window_Onload procedure you get the type
mismatch error. If you change the way you include testinc.vbs file to:
<SCRIPT Language="VBScript" src="testinc.vbs"></script>
then there is no problem. Note: example is not using anything from the
testinc.vbs file, its just the structure of how its included that is
relevant.
--------------------
<html>
<head>
<title>HTA Helpomatic</title>

<HTA:APPLICATION
ID="objHTAHelpomatic"
APPLICATIONNAME="HTAHelpomatic"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"


<SCRIPT Language="VBScript" src="testinc.vbs"/>
<SCRIPT Language="VBScript">

Sub Window_Onload
Msgbox "The application has started."
End Sub

</SCRIPT>
</head>

<body>

<h1>In the body</h1>
<input type="button" value="test" onclick="Window_Onload">

</body>
</html>
---------------------


.



Relevant Pages

  • Re: Logon HTA display not updating
    ... I have a HTA script that runs as a logon script. ... I use a textarea to display a timestamped message ... Sub Main ...
    (microsoft.public.scripting.vbscript)
  • Re: alternative to Wscript.Quit for use in HTA
    ... stop the script. ... How to I quit a vbscript inside a HTA. ... understand why I just want a way to stop the script running. ... I think what you want in that sub is "exit Sub", but frankly, I'm wondering ...
    (microsoft.public.scripting.vbscript)
  • Re: Check User Directories Script
    ... I have this script working as a .vbs script but was trying to make an HTA ... from a sub. ... search the user directories for the .exe or other file types. ...
    (microsoft.public.scripting.vbscript)
  • RE: Displaying text output in one external window
    ... Here is a full sample of hta application I use to control a script execution. ... The hta app is only designed for display purposes. ... Sub SaveScript() ...
    (microsoft.public.scripting.wsh)
  • Re: Logon HTA display not updating
    ... I think the problem could be due to running the HTA as a logon script? ... I use a textarea to display a timestamped message ... Sub Main ...
    (microsoft.public.scripting.vbscript)