MIS42N
2009-02-04 12:36:58 UTC
I am driving IE from an external vbscript (cscript xxx.vbs). I can
make IE do everything that I want, but it isn't neat and it's probably
non standard. What I want to do is get some input from the user,
process the input, change a few values in IE and trigger a function to
set up for more input (IFAIK it can't be done by dynamic HTML - IE is
driving Google Maps and needs to make a few calls). [and no the code
can't all be embedded in IE as it also uses WSH functions]
in IE I define a hidden field (used for signalling both ways)
<INPUT TYPE="hidden" ID="OK" NAME="OK" VALUE="0" OnClick="dosomething
()">
To get IE to talk to the vbs, the vbs spins:
----
do while ie.document.findelementbyID("OK").value=0
sleep 200
loop
----
and IE sets OK to something other than zero to show the user has
completed input
To get vbs to talk to IE
In vbs
----
' Signal we made a change
set elem=objIE.document.getElementById("OK")
elem.click
----
What worries me is I don't think the use of onclick on a hidden field
is supported by the DOM. Ideally, there would be a way for vbs to
discover the function dosomething() and call it directly but I don't
know how. The available documentation on the web is huge, obscure and
uninformative [well, to me who started using vbscript 3 months ago and
just started on jscript]. Is there a more elegant and/or more
standard way?
make IE do everything that I want, but it isn't neat and it's probably
non standard. What I want to do is get some input from the user,
process the input, change a few values in IE and trigger a function to
set up for more input (IFAIK it can't be done by dynamic HTML - IE is
driving Google Maps and needs to make a few calls). [and no the code
can't all be embedded in IE as it also uses WSH functions]
in IE I define a hidden field (used for signalling both ways)
<INPUT TYPE="hidden" ID="OK" NAME="OK" VALUE="0" OnClick="dosomething
()">
To get IE to talk to the vbs, the vbs spins:
----
do while ie.document.findelementbyID("OK").value=0
sleep 200
loop
----
and IE sets OK to something other than zero to show the user has
completed input
To get vbs to talk to IE
In vbs
----
' Signal we made a change
set elem=objIE.document.getElementById("OK")
elem.click
----
What worries me is I don't think the use of onclick on a hidden field
is supported by the DOM. Ideally, there would be a way for vbs to
discover the function dosomething() and call it directly but I don't
know how. The available documentation on the web is huge, obscure and
uninformative [well, to me who started using vbscript 3 months ago and
just started on jscript]. Is there a more elegant and/or more
standard way?