wsh2 beta 2 - how to sink events via <object> element 
Author Message
 wsh2 beta 2 - how to sink events via <object> element

In Andrew's last Scripting Clinic on WSH 2.0 features, he stated:

"...With the <object> element, you can create an object for use within the
script code. You have the option of responding to events from the object, and
also of getting those constants provided by the object..."

The wsh2 beta 2 docs don't say how to do either.  By way of experimentation, I
discovered that enabling reference for an <object> element is simply:

<object progid="some.progid" reference="true" />

but it only appears to work with components that have typelib info embedded in
the executable.

The syntax:

<object progid="some.progid" events="true" />

is tolerated.

Of course, the attribute apple="pie" is tolerated too, but events="pie" throws
an error saying that the value isn't valid for the attribute events, so I guess
I'm close since true/false, yes/no, on/off, 1/0 are all acceptable values to the
parser.

But I tried this (without success) with an IE application object

<job>
<object id="ie"
  progid="internetexplorer.application"
  events="yes"/>

<script language="VBScript">

  ie.navigate "about:blank"
  while ie.busy:wend
  ie.visible = 1
  ie.document.title = "New Title"
  msgbox "waiting"

  ie.document.title = "Another New Title"
  msgbox "waiting"

  sub ie_onquit()
    msgbox "quitting"
  end sub

  sub ie_titlechange()
    msgbox "quitting"
  end sub

</script>
</job>

==================================================

Obviously I'm missing something (other than documentation)...;-)

A separate and somewhat related question:

Is there a public DTD for the XML syntax of WS and/or WSC XML files, or is it
all hardcoded inside scrobj.dll.

--
Michael Harris



Sun, 16 Dec 2001 03:00:00 GMT  
 wsh2 beta 2 - how to sink events via <object> element
oops...

| <object id="myid" progid="some.progid" reference="true" />
...
| <object id="myid" progid="some.progid" events="true" />

I forgot the id attribute in the post (but not in the real code example)...

--
Michael Harris


| In Andrew's last Scripting Clinic on WSH 2.0 features, he stated:
|
| "...With the <object> element, you can create an object for use within the
| script code. You have the option of responding to events from the object, and
| also of getting those constants provided by the object..."
|
| The wsh2 beta 2 docs don't say how to do either.  By way of experimentation, I
| discovered that enabling reference for an <object> element is simply:
|
| <object progid="some.progid" reference="true" />
|
| but it only appears to work with components that have typelib info embedded in
| the executable.
|
| The syntax:
|
| <object progid="some.progid" events="true" />
|
| is tolerated.
|
| Of course, the attribute apple="pie" is tolerated too, but events="pie" throws
| an error saying that the value isn't valid for the attribute events, so I
guess
| I'm close since true/false, yes/no, on/off, 1/0 are all acceptable values to
the
| parser.
|
| But I tried this (without success) with an IE application object
|
| <job>
| <object id="ie"
|   progid="internetexplorer.application"
|   events="yes"/>
|
| <script language="VBScript">
|
|   ie.navigate "about:blank"
|   while ie.busy:wend
|   ie.visible = 1
|   ie.document.title = "New Title"
|   msgbox "waiting"
|
|   ie.document.title = "Another New Title"
|   msgbox "waiting"
|
|   sub ie_onquit()
|     msgbox "quitting"
|   end sub
|
|   sub ie_titlechange()
|     msgbox "quitting"
|   end sub
|
| </script>
| </job>
|
| ==================================================
|
| Obviously I'm missing something (other than documentation)...;-)
|
| A separate and somewhat related question:
|
| Is there a public DTD for the XML syntax of WS and/or WSC XML files, or is it
| all hardcoded inside scrobj.dll.
|
| --
| Michael Harris
|
|
|
|
|



Sun, 16 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WSH2 beta <object> element problem

2. --------<<<<<<MONEY>>>>>>--------- id 9543

3. <object> element errata

4. <object> and responding to events

5. onChange event for <SELECT> object

6. HowTo: Sinking Events in JScript from a COM Object

7. Sinking events for COM objects retrieved w/o CreateObject

8. Embedded IE object event sinking from wsh...

9. Sinking events from ATL object

10. Procedure name ambiguity goes undetected in WSH2 beta 2

11. WSH2 beta addwindowsprinterconnection

12. wsh2 beta 2 problems

 

 
Powered by phpBB® Forum Software