Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #34038 > unrolled thread

VB6/VBA array to JavaScript array

Started byBart Smissaert <bart.smissaert@gmail.com>
First post2017-09-26 16:00 -0700
Last post2017-09-29 14:20 -0700
Articles 20 on this page of 36 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-26 16:00 -0700
    Re: VB6/VBA array to JavaScript array "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-09-28 05:45 -0700
      Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-28 06:21 -0700
      Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-28 06:37 -0700
        Re: VB6/VBA array to JavaScript array "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-09-28 08:44 -0700
          Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-28 09:07 -0700
            Re: VB6/VBA array to JavaScript array Julio Di Egidio <julio@diegidio.name> - 2017-09-28 09:47 -0700
              Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-28 10:15 -0700
              Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 02:52 -0700
                Re: VB6/VBA array to JavaScript array Julio Di Egidio <julio@diegidio.name> - 2017-09-29 05:55 -0700
                  Re: VB6/VBA array to JavaScript array Julio Di Egidio <julio@diegidio.name> - 2017-09-29 06:00 -0700
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 06:29 -0700
                      Re: VB6/VBA array to JavaScript array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-29 17:06 +0200
          Re: VB6/VBA array to JavaScript array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-29 16:10 +0200
            Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 07:13 -0700
              Re: VB6/VBA array to JavaScript array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-29 17:14 +0200
                Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 08:24 -0700
                  Re: VB6/VBA array to JavaScript array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-29 19:08 +0200
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 10:41 -0700
                Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 08:27 -0700
                  Re: VB6/VBA array to JavaScript array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-29 19:11 +0200
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 10:43 -0700
                Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 08:42 -0700
                  Re: VB6/VBA array to JavaScript array Julio Di Egidio <julio@diegidio.name> - 2017-09-29 11:28 -0700
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 12:23 -0700
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 13:18 -0700
                      Re: VB6/VBA array to JavaScript array Julio Di Egidio <julio@diegidio.name> - 2017-09-29 15:34 -0700
                        Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 04:44 -0700
                          Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 05:43 -0700
                            Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 08:48 -0700
                        Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 07:52 -0700
                      Re: VB6/VBA array to JavaScript array "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-09-30 08:52 -0700
                        Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 09:12 -0700
                          Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 10:10 -0700
                            Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-30 10:16 -0700
                    Re: VB6/VBA array to JavaScript array Bart Smissaert <bart.smissaert@gmail.com> - 2017-09-29 14:20 -0700

Page 1 of 2  [1] 2  Next page →


#34038 — VB6/VBA array to JavaScript array

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-26 16:00 -0700
SubjectVB6/VBA array to JavaScript array
Message-ID<639d22ec-869c-482d-bd1c-4272dfb27b8c@googlegroups.com>
Trying to use a 2D array produced by VB6 in JavaScript.
Trying something like this:

function JS_ArrayTest(lParamCount, strParam1, lParam2, dParam3)

{

    var lBytes = 0;

    var a = new VBArray(UDF.Get2DByteArray(1, lBytes));  

    var b =a.ToArray();

    return lBytes;

}

Where UDF.Get2DByteArray(1, lBytes) produces the VB6 array.

With this I get an automation error, which I think is caused by a JS syntax error.
Any suggestions how this should be done?


RBS

[toc] | [next] | [standalone]


#34047

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-09-28 05:45 -0700
Message-ID<753cd5a0-573d-4e27-b312-60e63c209495@googlegroups.com>
In reply to#34038
Bart Smissaert wrote:
> Trying to use a 2D array produced by VB6 in JavaScript.
> Trying something like this:
> 
> function JS_ArrayTest(lParamCount, strParam1, lParam2, dParam3)
> 
> {
> 
>     var lBytes = 0;
> 
>     var a = new VBArray(UDF.Get2DByteArray(1, lBytes));  
> 
>     var b =a.ToArray();
> 
>     return lBytes;
> 
> }
> 
> Where UDF.Get2DByteArray(1, lBytes) produces the VB6 array.
> 
> With this I get an automation error, which I think is caused by a JS syntax error.
> Any suggestions how this should be done?

is this JavaScript, or JScript? What environments are you running this in?

[toc] | [prev] | [next] | [standalone]


#34050

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-28 06:21 -0700
Message-ID<094cfa51-c958-40cc-b9a2-334f9494ada6@googlegroups.com>
In reply to#34047
On Thursday, 28 September 2017 13:45:47 UTC+1, Michael Haufe (TNO)  wrote:
> Bart Smissaert wrote:
> > Trying to use a 2D array produced by VB6 in JavaScript.
> > Trying something like this:
> > 
> > function JS_ArrayTest(lParamCount, strParam1, lParam2, dParam3)
> > 
> > {
> > 
> >     var lBytes = 0;
> > 
> >     var a = new VBArray(UDF.Get2DByteArray(1, lBytes));  
> > 
> >     var b =a.ToArray();
> > 
> >     return lBytes;
> > 
> > }
> > 
> > Where UDF.Get2DByteArray(1, lBytes) produces the VB6 array.
> > 
> > With this I get an automation error, which I think is caused by a JS syntax error.
> > Any suggestions how this should be done?
> 
> is this JavaScript, or JScript? What environments are you running this in?

JScript:

   'Create instance of the language engine
   vbActiveScript3.CLSIDFromProgID "JScript", clsIDScriptType

It all runs in a VB6 ActiveX dll.


RBS

[toc] | [prev] | [next] | [standalone]


#34051

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-28 06:37 -0700
Message-ID<a6c840c4-60c3-44d8-bb67-2af3df1066b2@googlegroups.com>
In reply to#34047
On Thursday, 28 September 2017 13:45:47 UTC+1, Michael Haufe (TNO)  wrote:
> Bart Smissaert wrote:
> > Trying to use a 2D array produced by VB6 in JavaScript.
> > Trying something like this:
> > 
> > function JS_ArrayTest(lParamCount, strParam1, lParam2, dParam3)
> > 
> > {
> > 
> >     var lBytes = 0;
> > 
> >     var a = new VBArray(UDF.Get2DByteArray(1, lBytes));  
> > 
> >     var b =a.ToArray();
> > 
> >     return lBytes;
> > 
> > }
> > 
> > Where UDF.Get2DByteArray(1, lBytes) produces the VB6 array.
> > 
> > With this I get an automation error, which I think is caused by a JS syntax error.
> > Any suggestions how this should be done?
> 
> is this JavaScript, or JScript? What environments are you running this in?

Got some better information with better error handling:

JS error description:
Object doesn't support this property or method

JS Error source:	
JS line number:	89
JS code line:
    var a = VBArray(UDF.Get2DByteArray(1, lBytes));


RBS

[toc] | [prev] | [next] | [standalone]


#34052

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-09-28 08:44 -0700
Message-ID<e3f2f077-3643-4539-bb6a-1bf63a0a60c9@googlegroups.com>
In reply to#34051
Bart Smissaert wrote:
> Got some better information with better error handling:
> 
> JS error description:
> Object doesn't support this property or method
> 
> JS Error source:	
> JS line number:	89
> JS code line:
>     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> 

UDF is a free variable. Is it null? 

[toc] | [prev] | [next] | [standalone]


#34053

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-28 09:07 -0700
Message-ID<61901091-8f1f-4e3b-abb9-4aa960c34ae4@googlegroups.com>
In reply to#34052
On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> Bart Smissaert wrote:
> > Got some better information with better error handling:
> > 
> > JS error description:
> > Object doesn't support this property or method
> > 
> > JS Error source:	
> > JS line number:	89
> > JS code line:
> >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > 
> 
> UDF is a free variable. Is it null?

UDF is a VB6 class and it has been initialized, so it is active and not Null.
Null is not the right word, in VB6 speak you would say it is not Nothing.

RBS

[toc] | [prev] | [next] | [standalone]


#34054

FromJulio Di Egidio <julio@diegidio.name>
Date2017-09-28 09:47 -0700
Message-ID<3a7b8a1c-46ab-4f69-a8a3-4b8b2de234a2@googlegroups.com>
In reply to#34053
On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > Bart Smissaert wrote:
> > > Got some better information with better error handling:
> > > 
> > > JS error description:
> > > Object doesn't support this property or method
> > > 
> > > JS Error source:	
> > > JS line number:	89
> > > JS code line:
> > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > 
> > UDF is a free variable. Is it null?
> 
> UDF is a VB6 class and it has been initialized, so it is active and not Null.
> Null is not the right word, in VB6 speak you would say it is not Nothing.

You are writing JScript, not VBScript: and, given the error, something
is definitely not set as you are expecting it, the most common cause
indeed being undefined or null references.

Also, probably unrelated, but shouldn't that be *new* VBArray()?

Julio

[toc] | [prev] | [next] | [standalone]


#34055

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-28 10:15 -0700
Message-ID<b2514f09-8c61-433d-b158-a71667db6fd6@googlegroups.com>
In reply to#34054
On Thursday, 28 September 2017 17:47:19 UTC+1, Julio Di Egidio  wrote:
> On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> > On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > > Bart Smissaert wrote:
> > > > Got some better information with better error handling:
> > > > 
> > > > JS error description:
> > > > Object doesn't support this property or method
> > > > 
> > > > JS Error source:	
> > > > JS line number:	89
> > > > JS code line:
> > > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > > 
> > > UDF is a free variable. Is it null?
> > 
> > UDF is a VB6 class and it has been initialized, so it is active and not Null.
> > Null is not the right word, in VB6 speak you would say it is not Nothing.
> 
> You are writing JScript, not VBScript: and, given the error, something
> is definitely not set as you are expecting it, the most common cause
> indeed being undefined or null references.
> 
> Also, probably unrelated, but shouldn't that be *new* VBArray()?
> 
> Julio

> Also, probably unrelated, but shouldn't that be *new* VBArray()? 

I got the same error with the new keyword added.

RBS

[toc] | [prev] | [next] | [standalone]


#34057

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 02:52 -0700
Message-ID<d4e2ec64-8ec4-49c4-82e1-0236b0d5fcac@googlegroups.com>
In reply to#34054
On Thursday, 28 September 2017 17:47:19 UTC+1, Julio Di Egidio  wrote:
> On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> > On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > > Bart Smissaert wrote:
> > > > Got some better information with better error handling:
> > > > 
> > > > JS error description:
> > > > Object doesn't support this property or method
> > > > 
> > > > JS Error source:	
> > > > JS line number:	89
> > > > JS code line:
> > > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > > 
> > > UDF is a free variable. Is it null?
> > 
> > UDF is a VB6 class and it has been initialized, so it is active and not Null.
> > Null is not the right word, in VB6 speak you would say it is not Nothing.
> 
> You are writing JScript, not VBScript: and, given the error, something
> is definitely not set as you are expecting it, the most common cause
> indeed being undefined or null references.
> 
> Also, probably unrelated, but shouldn't that be *new* VBArray()?
> 
> Julio

So, do you think the JScript code is fine as it is and do you think it should work and make a JScript array from a VBA/VB6 array?
The UDF class works fine as I can run other JS code fine using procedures in that class.

RBS

[toc] | [prev] | [next] | [standalone]


#34058

FromJulio Di Egidio <julio@diegidio.name>
Date2017-09-29 05:55 -0700
Message-ID<bbf96640-92f9-4086-a02a-f3285c29c249@googlegroups.com>
In reply to#34057
On Friday, September 29, 2017 at 11:52:17 AM UTC+2, Bart Smissaert wrote:
> On Thursday, 28 September 2017 17:47:19 UTC+1, Julio Di Egidio  wrote:
> > On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> > > On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > > > Bart Smissaert wrote:
> > > > > Got some better information with better error handling:
> > > > > 
> > > > > JS error description:
> > > > > Object doesn't support this property or method
> > > > > 
> > > > > JS Error source:	
> > > > > JS line number:	89
> > > > > JS code line:
> > > > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > > > 
> > > > UDF is a free variable. Is it null?
> > > 
> > > UDF is a VB6 class and it has been initialized, so it is active and not Null.
> > > Null is not the right word, in VB6 speak you would say it is not Nothing.
> > 
> > You are writing JScript, not VBScript: and, given the error, something
> > is definitely not set as you are expecting it, the most common cause
> > indeed being undefined or null references.
> > 
> > Also, probably unrelated, but shouldn't that be *new* VBArray()?
> 
> So, do you think the JScript code is fine as it is and do you think it
> should work and make a JScript array from a VBA/VB6 array?

The code is obviously not fine, you are getting a run-time error.

> The UDF class works fine as I can run other JS code fine using procedures
> in that class.

Have you tried running that call?  What is it supposed to do when lBytes is
zero anyway?  And, have you noticed that the array is lost in the function,
you return lBytes.  But am I supposed to guess?  You have not even told
which platform you are on, so it's not even possible to suggest specific
debugging constructs, anyway that's what you should do: either debug step
into it, or break it down to the single instruction and print to the console
or even just alert the values you get: e.g. of UDF (should be an object),
UDF.Get2DByteArray (should be a function), UDF.Get2DByteArray(1, lBytes)
(should be some array-like object, I guess), etc., you get the picture...

Julio

[toc] | [prev] | [next] | [standalone]


#34059

FromJulio Di Egidio <julio@diegidio.name>
Date2017-09-29 06:00 -0700
Message-ID<e646da78-c50e-4b72-94de-c2351fd416c9@googlegroups.com>
In reply to#34058
On Friday, September 29, 2017 at 2:55:59 PM UTC+2, Julio Di Egidio wrote:
> On Friday, September 29, 2017 at 11:52:17 AM UTC+2, Bart Smissaert wrote:
> > On Thursday, 28 September 2017 17:47:19 UTC+1, Julio Di Egidio  wrote:
> > > On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> > > > On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > > > > Bart Smissaert wrote:
> > > > > > Got some better information with better error handling:
> > > > > > 
> > > > > > JS error description:
> > > > > > Object doesn't support this property or method
> > > > > > 
> > > > > > JS Error source:	
> > > > > > JS line number:	89
> > > > > > JS code line:
> > > > > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > > > > 
> > > > > UDF is a free variable. Is it null?
> > > > 
> > > > UDF is a VB6 class and it has been initialized, so it is active and not Null.
> > > > Null is not the right word, in VB6 speak you would say it is not Nothing.
> > > 
> > > You are writing JScript, not VBScript: and, given the error, something
> > > is definitely not set as you are expecting it, the most common cause
> > > indeed being undefined or null references.
> > > 
> > > Also, probably unrelated, but shouldn't that be *new* VBArray()?
> > 
> > So, do you think the JScript code is fine as it is and do you think it
> > should work and make a JScript array from a VBA/VB6 array?
> 
> The code is obviously not fine, you are getting a run-time error.
> 
> > The UDF class works fine as I can run other JS code fine using procedures
> > in that class.
> 
> Have you tried running that call?  What is it supposed to do when lBytes is
> zero anyway?  And, have you noticed that the array is lost in the function,
> you return lBytes.  But am I supposed to guess?  You have not even told
> which platform you are on, so it's not even possible to suggest specific
> debugging constructs, anyway that's what you should do: either debug step
> into it, or break it down to the single instruction and print to the console
> or even just alert the values you get: e.g. of UDF (should be an object),
> UDF.Get2DByteArray (should be a function), UDF.Get2DByteArray(1, lBytes)
> (should be some array-like object, I guess), etc., you get the picture...

P.S. Note also that you can only pass arguments by value in JS...  What is
the signature (i.e. arguments and return value) of UDF.Get2DByteArray?
In fact, is there any public documentation for that UDF object?

Julio

[toc] | [prev] | [next] | [standalone]


#34060

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 06:29 -0700
Message-ID<55b4b33f-02a4-4cb3-8490-d7aa1c2a8763@googlegroups.com>
In reply to#34059
On Friday, 29 September 2017 14:00:56 UTC+1, Julio Di Egidio  wrote:
> On Friday, September 29, 2017 at 2:55:59 PM UTC+2, Julio Di Egidio wrote:
> > On Friday, September 29, 2017 at 11:52:17 AM UTC+2, Bart Smissaert wrote:
> > > On Thursday, 28 September 2017 17:47:19 UTC+1, Julio Di Egidio  wrote:
> > > > On Thursday, September 28, 2017 at 6:07:42 PM UTC+2, Bart Smissaert wrote:
> > > > > On Thursday, 28 September 2017 16:45:23 UTC+1, Michael Haufe (TNO)  wrote:
> > > > > > Bart Smissaert wrote:
> > > > > > > Got some better information with better error handling:
> > > > > > > 
> > > > > > > JS error description:
> > > > > > > Object doesn't support this property or method
> > > > > > > 
> > > > > > > JS Error source:	
> > > > > > > JS line number:	89
> > > > > > > JS code line:
> > > > > > >     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > > > > > 
> > > > > > UDF is a free variable. Is it null?
> > > > > 
> > > > > UDF is a VB6 class and it has been initialized, so it is active and not Null.
> > > > > Null is not the right word, in VB6 speak you would say it is not Nothing.
> > > > 
> > > > You are writing JScript, not VBScript: and, given the error, something
> > > > is definitely not set as you are expecting it, the most common cause
> > > > indeed being undefined or null references.
> > > > 
> > > > Also, probably unrelated, but shouldn't that be *new* VBArray()?
> > > 
> > > So, do you think the JScript code is fine as it is and do you think it
> > > should work and make a JScript array from a VBA/VB6 array?
> > 
> > The code is obviously not fine, you are getting a run-time error.
> > 
> > > The UDF class works fine as I can run other JS code fine using procedures
> > > in that class.
> > 
> > Have you tried running that call?  What is it supposed to do when lBytes is
> > zero anyway?  And, have you noticed that the array is lost in the function,
> > you return lBytes.  But am I supposed to guess?  You have not even told
> > which platform you are on, so it's not even possible to suggest specific
> > debugging constructs, anyway that's what you should do: either debug step
> > into it, or break it down to the single instruction and print to the console
> > or even just alert the values you get: e.g. of UDF (should be an object),
> > UDF.Get2DByteArray (should be a function), UDF.Get2DByteArray(1, lBytes)
> > (should be some array-like object, I guess), etc., you get the picture...
> 
> P.S. Note also that you can only pass arguments by value in JS...  What is
> the signature (i.e. arguments and return value) of UDF.Get2DByteArray?
> In fact, is there any public documentation for that UDF object?
> 
> Julio

> Note also that you can only pass arguments by value in JS

OK, didn't know that and thought you could values ByRef. Will change that.

> UDF (should be an object),

Yes all that is as you say. Get2DByteArray is indeed a function and it returns
a 2D Integer VB6 array. I changed it from bytes as bytes in JS I understand are
signed and are the range -127 to +127.

The function doesn't actually run. As said all this run in VB6, that is an ActiveX dll.


RBS


[toc] | [prev] | [next] | [standalone]


#34064

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2017-09-29 17:06 +0200
Message-ID<1615398.8hzESeGDPO@PointedEars.de>
In reply to#34060
Bart Smissaert wrote:

> On Friday, 29 September 2017 14:00:56 UTC+1, Julio Di Egidio  wrote:
>> UDF (should be an object),
> 
> Yes all that is as you say. Get2DByteArray is indeed a function and it
> returns a 2D Integer VB6 array. I changed it from bytes as bytes in JS I
> understand are signed and are the range -127 to +127.

There is no single “JS” programming language.

_JScript_, which you must be using, is Microsoft’s implementation of 
ECMAScript, where the default (and usually only) numeric type is an 
implementation of IEEE-754 double-precision floating point numbers.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#34062

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2017-09-29 16:10 +0200
Message-ID<2518556.88bMQJbFj6@PointedEars.de>
In reply to#34052
Michael Haufe (TNO) wrote:

> Bart Smissaert wrote:
>> Got some better information with better error handling:
>> 
>> JS error description:
>> Object doesn't support this property or method
>> 
>> JS Error source:
>> JS line number:	89
>> JS code line:
>>     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> 
> UDF is a free variable.

ACK, since we are talking about bindings in ECMAScript now, that term may be 
used as well.

> Is it null?

I do not think that would result in *this* error message.  It is more likely 
that “UDF” is a reference to a host object that does not have this method.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#34063

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 07:13 -0700
Message-ID<69ab8c0b-fc31-4bd6-9b73-b67a78fa666e@googlegroups.com>
In reply to#34062
On Friday, 29 September 2017 15:10:24 UTC+1, Thomas 'PointedEars' Lahn  wrote:
> Michael Haufe (TNO) wrote:
> 
> > Bart Smissaert wrote:
> >> Got some better information with better error handling:
> >> 
> >> JS error description:
> >> Object doesn't support this property or method
> >> 
> >> JS Error source:
> >> JS line number:	89
> >> JS code line:
> >>     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> > 
> > UDF is a free variable.
> 
> ACK, since we are talking about bindings in ECMAScript now, that term may be 
> used as well.
> 
> > Is it null?
> 
> I do not think that would result in *this* error message.  It is more likely 
> that “UDF” is a reference to a host object that does not have this method.
> 
> -- 
> PointedEars
> FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

> It is more likely 
that “UDF” is a reference to a host object that does not have this method.


The VB6 class UDF does have the mentioned function

RBS

[toc] | [prev] | [next] | [standalone]


#34066

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2017-09-29 17:14 +0200
Message-ID<4192671.rnE6jSC6OK@PointedEars.de>
In reply to#34063
Bart Smissaert full-quoted:

> On Friday, 29 September 2017 15:10:24 UTC+1, Thomas 'PointedEars' Lahn 
> wrote:

Attribution *line*, not attribution novel.

>> Michael Haufe (TNO) wrote:
>> > Bart Smissaert wrote:
>> >>     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
>> > 
>> > UDF is a free variable.
>> […]
>> > Is it null?
>> I do not think that would result in *this* error message.  It is more
>> likely that “UDF” is a reference to a host object that does not have this
>> method.
> 
> The VB6 class UDF does have the mentioned function

That does not necessarily mean that

  1. “UDF” refers to the class or an instance of it in JScript,

and that

  2. the method is available in JScript.

For this to have a chance to work, you need to have something like

  var UDF = …;

in your JScript code *before* you refer to the identifier “UDF”.  The code 
that you posted does not contain such a line, so for that alone it is hard 
to make even an educated guess what might have gone wrong here.

Also, you have not specified your target/test runtime environment(s).
I presume it is Microsoft Internet Explorer up to including version 11 (as 
Microsoft Edge and other recent browsers do not support ActiveX – the API 
has proven to be a security risk, and the technology is proprietary), but
it could be something else.

Finally, you might want to consider switching to a different approach as 
Mainstream Support for Internet Explorer, and therefore ActiveX, will end 
starting 2018-09-01 CE:

<https://support.microsoft.com/en-us/help/17454/lifecycle-faq-internet-explorer>
<https://support.microsoft.com/en-us/lifecycle/search?alpha=Windows%2010>

I do not think it is necessary to use Visual Basic classes or the JScript 
“VBArray” type here.  More recent ECMAScript implementations support the now 
standards-compliant “Int8Array” type:

<http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-constructors>

According to MDN, Internet Explorer 10 has “Basic Support” of it:

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array>

So should IE 11.


Learn to quote.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.	

[toc] | [prev] | [next] | [standalone]


#34067

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 08:24 -0700
Message-ID<1cbeb3c9-c9a5-4e66-8493-686235eccd5c@googlegroups.com>
In reply to#34066
On Friday, 29 September 2017 16:15:05 UTC+1, Thomas 'PointedEars' Lahn  wrote:
> Bart Smissaert full-quoted:
> 
> > On Friday, 29 September 2017 15:10:24 UTC+1, Thomas 'PointedEars' Lahn 
> > wrote:
> 
> Attribution *line*, not attribution novel.
> 
> >> Michael Haufe (TNO) wrote:
> >> > Bart Smissaert wrote:
> >> >>     var a = VBArray(UDF.Get2DByteArray(1, lBytes));
> >> > 
> >> > UDF is a free variable.
> >> […]
> >> > Is it null?
> >> I do not think that would result in *this* error message.  It is more
> >> likely that “UDF” is a reference to a host object that does not have this
> >> method.
> > 
> > The VB6 class UDF does have the mentioned function
> 
> That does not necessarily mean that
> 
>   1. “UDF” refers to the class or an instance of it in JScript,
> 
> and that
> 
>   2. the method is available in JScript.
> 
> For this to have a chance to work, you need to have something like
> 
>   var UDF = …;
> 
> in your JScript code *before* you refer to the identifier “UDF”.  The code 
> that you posted does not contain such a line, so for that alone it is hard 
> to make even an educated guess what might have gone wrong here.
> 
> Also, you have not specified your target/test runtime environment(s).
> I presume it is Microsoft Internet Explorer up to including version 11 (as 
> Microsoft Edge and other recent browsers do not support ActiveX – the API 
> has proven to be a security risk, and the technology is proprietary), but
> it could be something else.
> 
> Finally, you might want to consider switching to a different approach as 
> Mainstream Support for Internet Explorer, and therefore ActiveX, will end 
> starting 2018-09-01 CE:
> 
> <https://support.microsoft.com/en-us/help/17454/lifecycle-faq-internet-explorer>
> <https://support.microsoft.com/en-us/lifecycle/search?alpha=Windows%2010>
> 
> I do not think it is necessary to use Visual Basic classes or the JScript 
> “VBArray” type here.  More recent ECMAScript implementations support the now 
> standards-compliant “Int8Array” type:
> 
> <http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-constructors>
> 
> According to MDN, Internet Explorer 10 has “Basic Support” of it:
> 
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array>
> 
> So should IE 11.
> 
> 
> Learn to quote.
> 
> -- 
> PointedEars
> FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

> For this to have a chance to work, you need to have something like
> 
>   var UDF = …;
> 
> in your JScript code *before* you refer to the identifier “UDF”.  The code 
> that you posted does not contain such a line, so for that alone it is hard 
> to make even an educated guess what might have gone wrong here.

This is not the problem. UDF is a global variable in my VB6 code and that works fine. This JS function for example works perfectly fine:

function JS_GetAge(lParamCount, strParam1, lParam2, dParam3)

{

    lDOB = UDF.GetInt32(1);

    if (lDOB == 0) {
        return -1;
    }

    var jDOB = new Date((lDOB - 25569) * 86400000);
    jDOBYear = jDOB.getFullYear();
    jDOBMonth = jDOB.getMonth();

    var todayDate = new Date();
    todayYear = todayDate.getFullYear();
    todayMonth = todayDate.getMonth(); //if replaced by app then it will do month minus 1 as JS does

    age = todayYear - jDOBYear;

    if (jDOBMonth > todayMonth) {
        age--;
        return age;
    }

    if (jDOBMonth < todayMonth) {
        return age;
   }

    jDOBDay = jDOB.getDate();
    todayDay = todayDate.getDate();
 
    if (jDOBDay > todayDay) {
         age--;
    }

    return age;

}


RBS

[toc] | [prev] | [next] | [standalone]


#34070

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2017-09-29 19:08 +0200
Message-ID<3783597.mogB4TqSGs@PointedEars.de>
In reply to#34067
Bart Smissaert full-quoted *again*:

> On Friday, 29 September 2017 16:15:05 UTC+1, Thomas 'PointedEars' Lahn 
> wrote:
>> Learn to quote.

<http://www.netmeister.org/news/learn2quote.html>

>> For this to have a chance to work, you need to have something like
>> 
>>   var UDF = …;
>> 
>> in your JScript code *before* you refer to the identifier “UDF”.  The
>> code that you posted does not contain such a line, so for that alone it
>> is hard to make even an educated guess what might have gone wrong here.
> 
> This is not the problem.

  Talk is cheap.  Show me the code. 

    –Linus Torvalds

> UDF is a global variable in my VB6 code and that
> works fine.

Global variables in your *VB6* code are _not_ automatically available/the 
same in your *JScript* code.

> This JS function for example works perfectly fine:

That does not mean anything.
 
> function JS_GetAge(lParamCount, strParam1, lParam2, dParam3)
> 
> {
> 
>     lDOB = UDF.GetInt32(1);

This method call would work, for example, if your *JScript* code contained 
the global variable declaration and initialization

  var UDF = {
    GetInt32: function (x) {
      return x >>> 0;
    }
  };
 
before, but any other method call would still not work.

>     if (lDOB == 0) {
>         return -1;
>     }
> 
>     var jDOB = new Date((lDOB - 25569) * 86400000);

Not a good idea.  Consider DST.

> […]
> }

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#34072

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 10:41 -0700
Message-ID<88c3b418-cd6c-4472-a5b6-dd29f6758e2f@googlegroups.com>
In reply to#34070
On Friday, 29 September 2017 18:08:44 UTC+1, Thomas 'PointedEars' Lahn  wrote:
> Bart Smissaert full-quoted *again*:
> 
> > On Friday, 29 September 2017 16:15:05 UTC+1, Thomas 'PointedEars' Lahn 
> > wrote:
> >> Learn to quote.
> 
> <http://www.netmeister.org/news/learn2quote.html>
> 
> >> For this to have a chance to work, you need to have something like
> >> 
> >>   var UDF = …;
> >> 
> >> in your JScript code *before* you refer to the identifier “UDF”.  The
> >> code that you posted does not contain such a line, so for that alone it
> >> is hard to make even an educated guess what might have gone wrong here.
> > 
> > This is not the problem.
> 
>   Talk is cheap.  Show me the code. 
> 
>     –Linus Torvalds
> 
> > UDF is a global variable in my VB6 code and that
> > works fine.
> > Global variables in your *VB6* code are _not_ automatically available/the 
> same in your *JScript* code.

> 
> > This JS function for example works perfectly fine:
> 
> That does not mean anything.
>  
> > function JS_GetAge(lParamCount, strParam1, lParam2, dParam3)
> > 
> > {
> > 
> >     lDOB = UDF.GetInt32(1);
> 
> This method call would work, for example, if your *JScript* code contained 
> the global variable declaration and initialization
> 
>   var UDF = {
>     GetInt32: function (x) {
>       return x >>> 0;
>     }
>   };
>  
> before, but any other method call would still not work.
> 
> >     if (lDOB == 0) {
> >         return -1;
> >     }
> > 
> >     var jDOB = new Date((lDOB - 25569) * 86400000);
> 
> Not a good idea.  Consider DST.
> 
> > […]
> > }
> 
> -- 
> PointedEars
> FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.


>>> Global variables in your *VB6* code are _not_ automatically available/the 
> same in your *JScript* code.

I understand that, but the UDF class is made available via VB6 code, not via JScript code. I could explain all to you but just believe me that that class is
available to JS and just works fine. This is just not the problem.

>> > Not a good idea.  Consider DST.

I am sure you are right, but this is irrelevant. I know nil about JScript and just trying things out.

RBS





[toc] | [prev] | [next] | [standalone]


#34068

FromBart Smissaert <bart.smissaert@gmail.com>
Date2017-09-29 08:27 -0700
Message-ID<a8a211f4-dbd0-470f-9d0d-92fa991b3336@googlegroups.com>
In reply to#34066
>> I presume it is Microsoft Internet Explorer

It doesn't run in MS Internet Explorer. It all runs in a VB6 ActiveX dll.
Unless I am mistaken, MS Internet Explorer has nil to do with this.

RBS

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web