Using a WSC to access Jscript functions from VBScript 
Author Message
 Using a WSC to access Jscript functions from VBScript

I suspect my problem is my use of Jscript here.

I have a WSC which use for various classes I add to some VBScripts; I added a push function which is just a wrapper around the
Jscript push, and get the following runtime errors attempting to use it:

---------------------------
An exception of type 'Microsoft JScript runtime error: Object doesn't support this property or method' was not handled.
---------------------------

The Jscript documentation says to check my object's documentation; I decided to skip the recursion and just ask what the heck I did
wrong.

Running the de{*filter*} shows that it gets to the push operation in the WSC, and at that point sees the elements of an array as integer
values and the new element as a Long.  I don't think that matters - I tried it with strings, same problem... I'll shut up now and
show you the code:

---------------------------

Here's my VBScript:

set oArrays= CreateObject("arrayManip.wsc") '<--name and progid of wsc I use
y = array(93,23,45,6)
oArrays.jpush y,CInt(22)

---------------------------

In the WSC:

 <method name="jpush">
  <PARAMETER name="arrayObj"/>
  <PARAMETER name="iData"/>
 </method>

<script language="Jscript">
<![CDATA[
function jpush(arrayObj,iData)
{
arrayObj.push(iData);

Quote:
}

]]>
</script>
<script language="JScript">


Tue, 17 Aug 2004 19:29:44 GMT  
 Using a WSC to access Jscript functions from VBScript
Hi,

See this google search:
http://www.*-*-*.com/ +toJarray+group%3A*wsh

VBS arrays are SafeArrays and JScript arrays are objects.
The author wrote several conversion functions that you might need.

hth,
Mark Pryor



Quote:
> I suspect my problem is my use of Jscript here.

> I have a WSC which use for various classes I add to some VBScripts; I added a push

function which is just a wrapper around the
Quote:
> Jscript push, and get the following runtime errors attempting to use it:

> ---------------------------
> An exception of type 'Microsoft JScript runtime error: Object doesn't support this

property or method' was not handled.
Quote:
> ---------------------------

> The Jscript documentation says to check my object's documentation; I decided to skip

the recursion and just ask what the heck I did
Quote:
> wrong.

> Running the de{*filter*} shows that it gets to the push operation in the WSC, and at that

point sees the elements of an array as integer
Quote:
> values and the new element as a Long.  I don't think that matters - I tried it with

strings, same problem... I'll shut up now and
Quote:
> show you the code:

> ---------------------------

> Here's my VBScript:

> set oArrays= CreateObject("arrayManip.wsc") '<--name and progid of wsc I use
> y = array(93,23,45,6)
> oArrays.jpush y,CInt(22)

> ---------------------------

> In the WSC:

>  <method name="jpush">
>   <PARAMETER name="arrayObj"/>
>   <PARAMETER name="iData"/>
>  </method>

> <script language="Jscript">
> <![CDATA[
> function jpush(arrayObj,iData)
> {
> arrayObj.push(iData);
> }
> ]]>
> </script>
> <script language="JScript">



Tue, 17 Aug 2004 22:26:09 GMT  
 Using a WSC to access Jscript functions from VBScript
Oof.  Thanks, Mark.  Looking at that explains a few things I didn't understand, and raises even more questions.  I noticed that
Jscript treated arrays as objects and went right on reading without considering the implications earlier..

: Hi,
:
: See this google search:
: http://www.*-*-*.com/ +toJarray+group%3A*wsh
:
: VBS arrays are SafeArrays and JScript arrays are objects.
: The author wrote several conversion functions that you might need.
:
: hth,
: Mark Pryor
:


: > I suspect my problem is my use of Jscript here.
: >
: > I have a WSC which use for various classes I add to some VBScripts; I added a push
: function which is just a wrapper around the
: > Jscript push, and get the following runtime errors attempting to use it:
: >
: > ---------------------------
: > An exception of type 'Microsoft JScript runtime error: Object doesn't support this
: property or method' was not handled.
: > ---------------------------
: >
: > The Jscript documentation says to check my object's documentation; I decided to skip
: the recursion and just ask what the heck I did
: > wrong.
: >
: > Running the de{*filter*} shows that it gets to the push operation in the WSC, and at that
: point sees the elements of an array as integer
: > values and the new element as a Long.  I don't think that matters - I tried it with
: strings, same problem... I'll shut up now and
: > show you the code:
: >
: > ---------------------------
: >
: > Here's my VBScript:
: >
: > set oArrays= CreateObject("arrayManip.wsc") '<--name and progid of wsc I use
: > y = array(93,23,45,6)
: > oArrays.jpush y,CInt(22)
: >
: > ---------------------------
: >
: > In the WSC:
: >
: >  <method name="jpush">
: >   <PARAMETER name="arrayObj"/>
: >   <PARAMETER name="iData"/>
: >  </method>
: >
: > <script language="Jscript">
: > <![CDATA[
: > function jpush(arrayObj,iData)
: > {
: > arrayObj.push(iData);
: > }
: > ]]>
: > </script>
: > <script language="JScript">
: >
: >
:



Tue, 17 Aug 2004 22:55:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Interfacing with Access object using WSC written in JScript

2. WSC - JScript - COM+ - Unable to access Error object after SetAbort

3. WSC - JScript - COM+ - Unable to access Error object after SetAbort

4. using VBScript to access a function in an activex control

5. using vbscript functions from jscript?

6. Does VBScript has a function similar to JScript function eval

7. Using WSC files from ASP (VBScript)

8. Using WSC files from ASP (VBScript)

9. Can you Access an Access database using VBScript

10. using VBscript to access Access database in public folder

11. Accessing device functions via JScript

12. WScript Function Using JScript

 

 
Powered by phpBB® Forum Software