I have a script, in it, it calls open it to invokes a HTA that is
really just a form for someone to fill out with some information. I
can get the script to invoke the client HTA, but I find that its
reference to is lost, and therefore resultig in an error. Here is my
script code:

Set objExp = CreateObject("InternetExplorer.Application", "IE_")
objExp.Navigate "file:///c:\temp.sample.hta"
objExp.Toolbar = 0
objExp.Statusbar = 0
objExp.Top = 0
objExp.Visible = 1
Do While (objExp.Document.All.OKClicked.Value = "")
wscript.Sleep 250
Loop

fName = objExp.Document.All.fName.value
etc.



When the script gets to the "Do While" it errors out with error:
"(null): The object invoked has disconnected from its clients." Is
there anyway that I can invoke an HTA through possibly a different COM
object that would let me later retreive HTML value from the HTA open,
like you could with an HTML document....I think an alternative is to
have the HTA write the values to a text file when OK clicked, and then
have the script sleep until the text file exists, once exists open text
file and readLine() its values, but I was just wondering if their was a
better way. Thanks

Re: Does anyone know how if their is a COM object I can call on to open HTA's? by McKirahan

McKirahan
Mon Dec 06 12:06:30 CST 2004

"ItsMillerTime4u" <itsmillertime4u@yahoo.com> wrote in message
news:1102353726.303363.72120@z14g2000cwz.googlegroups.com...
> I have a script, in it, it calls open it to invokes a HTA that is
> really just a form for someone to fill out with some information. I
> can get the script to invoke the client HTA, but I find that its
> reference to is lost, and therefore resultig in an error. Here is my
> script code:
>
> Set objExp = CreateObject("InternetExplorer.Application", "IE_")
> objExp.Navigate "file:///c:\temp.sample.hta"
> objExp.Toolbar = 0
> objExp.Statusbar = 0
> objExp.Top = 0
> objExp.Visible = 1
> Do While (objExp.Document.All.OKClicked.Value = "")
> wscript.Sleep 250
> Loop
>
> fName = objExp.Document.All.fName.value
> etc.
>
>
>
> When the script gets to the "Do While" it errors out with error:
> "(null): The object invoked has disconnected from its clients." Is
> there anyway that I can invoke an HTA through possibly a different COM
> object that would let me later retreive HTML value from the HTA open,
> like you could with an HTML document....I think an alternative is to
> have the HTA write the values to a text file when OK clicked, and then
> have the script sleep until the text file exists, once exists open text
> file and readLine() its values, but I was just wondering if their was a
> better way. Thanks
>

HTAs are run under MSHTA.exe not IEXPLORE.exe; try invoking by the RUN
method.

What does you HTA do and/or what doi you want it to do?



Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Mon Dec 06 13:34:18 CST 2004

The hta is just a form (<table> with <input> tags) to gather some
information that the parent script will need to do some functions. The
HTA also does some Active X controls, So I can't use an HTM. I got it
running right using the Run Method, but when I do that the only way
(that I know of) inwhich I can grab what was put in the HTA <input>
fields, is to have script in the HTA that writes the info to a text
file when the OK is clicked.....then close itself.....meanwhile the
parent script is waiting for the file to be created so that it can do a
ReadLine() method to gather what the HTA wrote to it....hence in a way
retreiving what text was entered in the <input> tags of the HTA.


But when I think about what I am doing....it seems like I'm doing it in
a way that too complex for what I am trying to achieve. In IEXPLORE
you can just connect to the COM object, have it browse to a file, then
have it gather the <input> tag info when OK clicked without having to
read/write to a text file.


Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Mon Dec 06 13:34:40 CST 2004

The hta is just a form (<table> with <input> tags) to gather some
information that the parent script will need to do some functions. The
HTA also does some Active X controls, So I can't use an HTM. I got it
running right using the Run Method, but when I do that the only way
(that I know of) inwhich I can grab what was put in the HTA <input>
fields, is to have script in the HTA that writes the info to a text
file when the OK is clicked.....then close itself.....meanwhile the
parent script is waiting for the file to be created so that it can do a
ReadLine() method to gather what the HTA wrote to it....hence in a way
retreiving what text was entered in the <input> tags of the HTA.


But when I think about what I am doing....it seems like I'm doing it in
a way that too complex for what I am trying to achieve. In IEXPLORE
you can just connect to the COM object, have it browse to a file, then
have it gather the <input> tag info when OK clicked without having to
read/write to a text file.


Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Mon Dec 06 13:35:05 CST 2004

The hta is just a form (<table> with <input> tags) to gather some
information that the parent script will need to do some functions. The
HTA also does some Active X controls, So I can't use an HTM. I got it
running right using the Run Method, but when I do that the only way
(that I know of) inwhich I can grab what was put in the HTA <input>
fields, is to have script in the HTA that writes the info to a text
file when the OK is clicked.....then close itself.....meanwhile the
parent script is waiting for the file to be created so that it can do a
ReadLine() method to gather what the HTA wrote to it....hence in a way
retreiving what text was entered in the <input> tags of the HTA.


But when I think about what I am doing....it seems like I'm doing it in
a way that too complex for what I am trying to achieve. In IEXPLORE
you can just connect to the COM object, have it browse to a file, then
have it gather the <input> tag info when OK clicked without having to
read/write to a text file.


Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Mon Dec 06 13:35:48 CST 2004

The hta is just a form (<table> with <input> tags) to gather some
information that the parent script will need to do some functions. The
HTA also does some Active X controls, So I can't use an HTM. I got it
running right using the Run Method, but when I do that the only way
(that I know of) inwhich I can grab what was put in the HTA <input>
fields, is to have script in the HTA that writes the info to a text
file when the OK is clicked.....then close itself.....meanwhile the
parent script is waiting for the file to be created so that it can do a
ReadLine() method to gather what the HTA wrote to it....hence in a way
retreiving what text was entered in the <input> tags of the HTA.


But when I think about what I am doing....it seems like I'm doing it in
a way that too complex for what I am trying to achieve. In IEXPLORE
you can just connect to the COM object, have it browse to a file, then
have it gather the <input> tag info when OK clicked without having to
read/write to a text file.


Re: Does anyone know how if their is a COM object I can call on to open HTA's? by McKirahan

McKirahan
Mon Dec 06 13:54:01 CST 2004

"ItsMillerTime4u" <itsmillertime4u@yahoo.com> wrote in message
news:1102361658.180086.240030@f14g2000cwb.googlegroups.com...
> The hta is just a form (<table> with <input> tags) to gather some
> information that the parent script will need to do some functions. The
> HTA also does some Active X controls, So I can't use an HTM. I got it
> running right using the Run Method, but when I do that the only way
> (that I know of) inwhich I can grab what was put in the HTA <input>
> fields, is to have script in the HTA that writes the info to a text
> file when the OK is clicked.....then close itself.....meanwhile the
> parent script is waiting for the file to be created so that it can do a
> ReadLine() method to gather what the HTA wrote to it....hence in a way
> retreiving what text was entered in the <input> tags of the HTA.
>
>
> But when I think about what I am doing....it seems like I'm doing it in
> a way that too complex for what I am trying to achieve. In IEXPLORE
> you can just connect to the COM object, have it browse to a file, then
> have it gather the <input> tag info when OK clicked without having to
> read/write to a text file.
>

"The HTA also does some Active X controls, So I can't use an HTM. "

Why do you think that?

You can run ActiveX controls in a Web page (.htm file) but you'll get a
security warning.

Who is your audience -- Web site visitors (Internet), co-workers (Intranet),
et.al.?

What, specifically, are you trying to do?



Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Mon Dec 06 18:08:47 CST 2004

This is for co-workers (intranet) The HTA code that I use does a
onLoad() query that pulls OU and user information from Win 2K Active
Directory.....If I have the code as an HTM, it gives me on Active X
error on the line of code that is doing a
GetObject("LDAP://OU=site,DC=something,DC=com"), but If I save the code
as an HTA I don't get this error.


Re: Does anyone know how if their is a COM object I can call on to by Christoph

Christoph
Tue Dec 07 03:34:18 CST 2004

06.12.2004 18:22, ItsMillerTime4u schrieb:

> I have a script, in it, it calls open it to invokes a HTA that is
> really just a form for someone to fill out with some information. I
> can get the script to invoke the client HTA, but I find that its
> reference to is lost, and therefore resultig in an error. Here is my
> script code:
>
> Set objExp = CreateObject("InternetExplorer.Application", "IE_")
> objExp.Navigate "file:///c:\temp.sample.hta"
> objExp.Toolbar = 0
> objExp.Statusbar = 0
> objExp.Top = 0
> objExp.Visible = 1
> Do While (objExp.Document.All.OKClicked.Value = "")
> wscript.Sleep 250
> Loop
>
> fName = objExp.Document.All.fName.value
> etc.

> When the script gets to the "Do While" it errors out with error:
> "(null): The object invoked has disconnected from its clients." Is
> there anyway that I can invoke an HTA through possibly a different COM
> object that would let me later retreive HTML value from the HTA open,
> like you could with an HTML document....I think an alternative is to
> have the HTA write the values to a text file when OK clicked, and then
> have the script sleep until the text file exists, once exists open text
> file and readLine() its values, but I was just wondering if their was a

Why scripting the HTA, why not script inside the HTA? That's what it is
for.
Whatever your script does, when OKClicked is <> "" you could
also do in the HTA's script. Without odd workarounds.


--
Gruesse, Christoph

Rio Riay Riayo - Gordon Sumner, 1979

Re: Does anyone know how if their is a COM object I can call on to open HTA's? by ItsMillerTime4u

ItsMillerTime4u
Tue Dec 07 11:31:35 CST 2004

I'm actually doing both, scripting an HTA and scripting inside a HTA.
I have a The main HTA which has several buttons. When certain ones are
pressed, the script in the main HTA spawn off a child HTA to preform a
specific function. Example: to create a new user it spawns off the
newUser.hta file to collect information for the new accout to be
created. Here is some of my code for the child HTA:

<script language=VBScript>
Sub Window_Onload
self.resizeTo 280, 170
set colSites = GetObject("LDAP://OU=Sites,DC=somewhere,DC=com")
strHTML = "<select size='1' name='sitePulldown' id='sitePulldown'>"
strHTML = strHTML & "<option value=" & Chr(34) &_
"Site" & Chr(34) & ">Site"
For Each objSite in colSites
strHTML = strHTML & "<option value=" & Chr(34) &_
Right(objSite.Name,3) & Chr(34) & ">" & Right(objSite.Name,3)
Next
strHTML = strHTML & "</select>"
siteList.InnerHTML = strHTML
End Sub

Sub OKButton_OnClick
strFName = ""
strLName = ""
strSite = ""
With document.all(firstName)
If .Value <> "" Then strFName = .Value
End With
With document.all(lastName)
If .Value <> "" Then strLName = .Value
End With
With document.all(sitePulldown)
If .Value <> "Site" Then strSite = .Value
End With
If strFName <> "" AND strLName <> "" AND strSite <> "" Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\temp\newUser.log", True)
objFile.WriteLine strFName
objFile.WriteLine strLName
objFile.WriteLine strSite
objFile.Close
objFSO.MoveFile "C:\temp\newUser.log", "C:\temp\newUser.txt"
OKClicked.Value = 1
window.close
End If
End Sub
</script>
<!--etc. table with input tags for input of the user's first and last
name-->
<!--span tag for site selection-->
<!--OK button-->
</body>
</html>


Basically the Parent HTA waits on the other end waiting in a loop for
"C:\temp\newUser.txt" to exist, once it does then it opens it and
retreives the information that the spawned child HTA put into it. This
works, but I was wondering if there was an easier way of calling
another HTA, and then gathering information that someone put into the
<Input> tags of the HTA that I called upon.


Re: Does anyone know how if their is a COM object I can call on to open HTA's? by McKirahan

McKirahan
Tue Dec 07 12:16:47 CST 2004

"ItsMillerTime4u" <itsmillertime4u@yahoo.com> wrote in message
news:1102440695.705364.220840@f14g2000cwb.googlegroups.com...
> I'm actually doing both, scripting an HTA and scripting inside a HTA.
> I have a The main HTA which has several buttons. When certain ones are
> pressed, the script in the main HTA spawn off a child HTA to preform a
> specific function. Example: to create a new user it spawns off the
> newUser.hta file to collect information for the new accout to be
> created. Here is some of my code for the child HTA:
>
> <script language=VBScript>
> Sub Window_Onload
> self.resizeTo 280, 170
> set colSites = GetObject("LDAP://OU=Sites,DC=somewhere,DC=com")
> strHTML = "<select size='1' name='sitePulldown' id='sitePulldown'>"
> strHTML = strHTML & "<option value=" & Chr(34) &_
> "Site" & Chr(34) & ">Site"
> For Each objSite in colSites
> strHTML = strHTML & "<option value=" & Chr(34) &_
> Right(objSite.Name,3) & Chr(34) & ">" & Right(objSite.Name,3)
> Next
> strHTML = strHTML & "</select>"
> siteList.InnerHTML = strHTML
> End Sub
>
> Sub OKButton_OnClick
> strFName = ""
> strLName = ""
> strSite = ""
> With document.all(firstName)
> If .Value <> "" Then strFName = .Value
> End With
> With document.all(lastName)
> If .Value <> "" Then strLName = .Value
> End With
> With document.all(sitePulldown)
> If .Value <> "Site" Then strSite = .Value
> End With
> If strFName <> "" AND strLName <> "" AND strSite <> "" Then
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFile = objFSO.CreateTextFile("C:\temp\newUser.log", True)
> objFile.WriteLine strFName
> objFile.WriteLine strLName
> objFile.WriteLine strSite
> objFile.Close
> objFSO.MoveFile "C:\temp\newUser.log", "C:\temp\newUser.txt"
> OKClicked.Value = 1
> window.close
> End If
> End Sub
> </script>
> <!--etc. table with input tags for input of the user's first and last
> name-->
> <!--span tag for site selection-->
> <!--OK button-->
> </body>
> </html>
>
>
> Basically the Parent HTA waits on the other end waiting in a loop for
> "C:\temp\newUser.txt" to exist, once it does then it opens it and
> retreives the information that the spawned child HTA put into it. This
> works, but I was wondering if there was an easier way of calling
> another HTA, and then gathering information that someone put into the
> <Input> tags of the HTA that I called upon.
>

You don't have to call another HTA.

Use DHTML to show/hide portions of your application.