ByRef? 
Author Message
 ByRef?

I need to call a function exposed by a third party object. The function
needs two parameters, a String of the command and a String to receive the
response, it returns an integer of the success. Code was
var oGWC = new ActiveXObject("xxx.xxx");
var sCommand = "whatever";
var sBuffer
var iResult = oGWC.exec(sCommand, sBuffer);
WScript.echo sBuffer

It always executes correctly according to the iResult but it never fills in
the sBuffer. I've tried various options on the 'var sBuffer' line:
var sBuffer = new String();
var sBuffer = new String("");
var sBuffer = new String("              ");
var sBuffer = "";
var sBuffer = "           ";

and no var line at all.
Could anyone help, it's driving me mad, it works fine in VB, but not in
VBScript either.

Joe



Thu, 24 Jul 2003 01:03:56 GMT  
 ByRef?
JScript (per ECMAScript specs) does not support ByRef arguments, only ByVal...

Q269258 - INFO: JScript Passes Variables by Value
http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> I need to call a function exposed by a third party object. The function
> needs two parameters, a String of the command and a String to receive the
> response, it returns an integer of the success. Code was
> var oGWC = new ActiveXObject("xxx.xxx");
> var sCommand = "whatever";
> var sBuffer
> var iResult = oGWC.exec(sCommand, sBuffer);
> WScript.echo sBuffer

> It always executes correctly according to the iResult but it never fills in
> the sBuffer. I've tried various options on the 'var sBuffer' line:
> var sBuffer = new String();
> var sBuffer = new String("");
> var sBuffer = new String("              ");
> var sBuffer = "";
> var sBuffer = "           ";

> and no var line at all.
> Could anyone help, it's driving me mad, it works fine in VB, but not in
> VBScript either.

> Joe



Thu, 24 Jul 2003 09:37:36 GMT  
 ByRef?
So all these style of functions are out of my reach?

Quote:
> JScript (per ECMAScript specs) does not support ByRef arguments, only
ByVal...

> Q269258 - INFO: JScript Passes Variables by Value
> http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --




- Show quoted text -

Quote:
> > I need to call a function exposed by a third party object. The function
> > needs two parameters, a String of the command and a String to receive
the
> > response, it returns an integer of the success. Code was
> > var oGWC = new ActiveXObject("xxx.xxx");
> > var sCommand = "whatever";
> > var sBuffer
> > var iResult = oGWC.exec(sCommand, sBuffer);
> > WScript.echo sBuffer

> > It always executes correctly according to the iResult but it never fills
in
> > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > var sBuffer = new String();
> > var sBuffer = new String("");
> > var sBuffer = new String("              ");
> > var sBuffer = "";
> > var sBuffer = "           ";

> > and no var line at all.
> > Could anyone help, it's driving me mad, it works fine in VB, but not in
> > VBScript either.

> > Joe



Fri, 25 Jul 2003 03:11:45 GMT  
 ByRef?
Form direct JScript -yes, but you can wrap the object in VBScript or another
COM component to make the sBuffer accessable.

Richard


Quote:
> So all these style of functions are out of my reach?


> > JScript (per ECMAScript specs) does not support ByRef arguments, only
> ByVal...

> > Q269258 - INFO: JScript Passes Variables by Value
> > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup instead.
> > --



> > > I need to call a function exposed by a third party object. The
function
> > > needs two parameters, a String of the command and a String to receive
> the
> > > response, it returns an integer of the success. Code was
> > > var oGWC = new ActiveXObject("xxx.xxx");
> > > var sCommand = "whatever";
> > > var sBuffer
> > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > WScript.echo sBuffer

> > > It always executes correctly according to the iResult but it never
fills
> in
> > > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > > var sBuffer = new String();
> > > var sBuffer = new String("");
> > > var sBuffer = new String("              ");
> > > var sBuffer = "";
> > > var sBuffer = "           ";

> > > and no var line at all.
> > > Could anyone help, it's driving me mad, it works fine in VB, but not
in
> > > VBScript either.

> > > Joe



Fri, 25 Jul 2003 06:15:34 GMT  
 ByRef?
you can also try using a scriptlet ...

check out:

http://msdn.microsoft.com/library/default.asp?URL=/library/partbook/d...
tantdhtmlscriptlets.htm

-TH



Quote:
> Form direct JScript -yes, but you can wrap the object in VBScript or
another
> COM component to make the sBuffer accessable.

> Richard



> > So all these style of functions are out of my reach?


> > > JScript (per ECMAScript specs) does not support ByRef arguments, only
> > ByVal...

> > > Q269258 - INFO: JScript Passes Variables by Value
> > > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > > --
> > > Michael Harris
> > > Microsoft.MVP.Scripting
> > > --

> > > Please do not email questions - post them to the newsgroup instead.
> > > --



> > > > I need to call a function exposed by a third party object. The
> function
> > > > needs two parameters, a String of the command and a String to
receive
> > the
> > > > response, it returns an integer of the success. Code was
> > > > var oGWC = new ActiveXObject("xxx.xxx");
> > > > var sCommand = "whatever";
> > > > var sBuffer
> > > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > > WScript.echo sBuffer

> > > > It always executes correctly according to the iResult but it never
> fills
> > in
> > > > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > > > var sBuffer = new String();
> > > > var sBuffer = new String("");
> > > > var sBuffer = new String("              ");
> > > > var sBuffer = "";
> > > > var sBuffer = "           ";

> > > > and no var line at all.
> > > > Could anyone help, it's driving me mad, it works fine in VB, but not
> in
> > > > VBScript either.

> > > > Joe



Fri, 25 Jul 2003 06:34:44 GMT  
 ByRef?
According to his code, he's running in the script host, this particular
article points to DHTML scriptlets... maybe from a 'server scriptlet',
called a Script Component... but what exactly did you hvae in mind, Tim, I'm
curious to know...?


Quote:
> you can also try using a scriptlet ...

> check out:

http://msdn.microsoft.com/library/default.asp?URL=/library/partbook/d...
Quote:
> tantdhtmlscriptlets.htm

> -TH



> > Form direct JScript -yes, but you can wrap the object in VBScript or
> another
> > COM component to make the sBuffer accessable.

> > Richard



> > > So all these style of functions are out of my reach?


> > > > JScript (per ECMAScript specs) does not support ByRef arguments,
only
> > > ByVal...

> > > > Q269258 - INFO: JScript Passes Variables by Value
> > > > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > > > --
> > > > Michael Harris
> > > > Microsoft.MVP.Scripting
> > > > --

> > > > Please do not email questions - post them to the newsgroup instead.
> > > > --



> > > > > I need to call a function exposed by a third party object. The
> > function
> > > > > needs two parameters, a String of the command and a String to
> receive
> > > the
> > > > > response, it returns an integer of the success. Code was
> > > > > var oGWC = new ActiveXObject("xxx.xxx");
> > > > > var sCommand = "whatever";
> > > > > var sBuffer
> > > > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > > > WScript.echo sBuffer

> > > > > It always executes correctly according to the iResult but it never
> > fills
> > > in
> > > > > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > > > > var sBuffer = new String();
> > > > > var sBuffer = new String("");
> > > > > var sBuffer = new String("              ");
> > > > > var sBuffer = "";
> > > > > var sBuffer = "           ";

> > > > > and no var line at all.
> > > > > Could anyone help, it's driving me mad, it works fine in VB, but
not
> > in
> > > > > VBScript either.

> > > > > Joe



Fri, 25 Jul 2003 06:41:45 GMT  
 ByRef?
One more thing.  Code your scriptlet in a language that accepts byref
(VBScript)

-TH



Quote:
> According to his code, he's running in the script host, this particular
> article points to DHTML scriptlets... maybe from a 'server scriptlet',
> called a Script Component... but what exactly did you hvae in mind, Tim,
I'm
> curious to know...?



> > you can also try using a scriptlet ...

> > check out:

http://msdn.microsoft.com/library/default.asp?URL=/library/partbook/d...
Quote:
> > tantdhtmlscriptlets.htm

> > -TH



> > > Form direct JScript -yes, but you can wrap the object in VBScript or
> > another
> > > COM component to make the sBuffer accessable.

> > > Richard



> > > > So all these style of functions are out of my reach?


> > > > > JScript (per ECMAScript specs) does not support ByRef arguments,
> only
> > > > ByVal...

> > > > > Q269258 - INFO: JScript Passes Variables by Value
> > > > > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > > > > --
> > > > > Michael Harris
> > > > > Microsoft.MVP.Scripting
> > > > > --

> > > > > Please do not email questions - post them to the newsgroup
instead.
> > > > > --



> > > > > > I need to call a function exposed by a third party object. The
> > > function
> > > > > > needs two parameters, a String of the command and a String to
> > receive
> > > > the
> > > > > > response, it returns an integer of the success. Code was
> > > > > > var oGWC = new ActiveXObject("xxx.xxx");
> > > > > > var sCommand = "whatever";
> > > > > > var sBuffer
> > > > > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > > > > WScript.echo sBuffer

> > > > > > It always executes correctly according to the iResult but it
never
> > > fills
> > > > in
> > > > > > the sBuffer. I've tried various options on the 'var sBuffer'
line:
> > > > > > var sBuffer = new String();
> > > > > > var sBuffer = new String("");
> > > > > > var sBuffer = new String("              ");
> > > > > > var sBuffer = "";
> > > > > > var sBuffer = "           ";

> > > > > > and no var line at all.
> > > > > > Could anyone help, it's driving me mad, it works fine in VB, but
> not
> > > in
> > > > > > VBScript either.

> > > > > > Joe



Fri, 25 Jul 2003 07:13:38 GMT  
 ByRef?
Check out;

http://msdn.microsoft.com/library/partbook/dhtm/dhtmlscriptletsserver...
ets.htm

You can use either.  I just know that the byref actually works with these
guys as long as you pass something in ...

-TH



Quote:
> According to his code, he's running in the script host, this particular
> article points to DHTML scriptlets... maybe from a 'server scriptlet',
> called a Script Component... but what exactly did you hvae in mind, Tim,
I'm
> curious to know...?



> > you can also try using a scriptlet ...

> > check out:

http://msdn.microsoft.com/library/default.asp?URL=/library/partbook/d...
Quote:
> > tantdhtmlscriptlets.htm

> > -TH



> > > Form direct JScript -yes, but you can wrap the object in VBScript or
> > another
> > > COM component to make the sBuffer accessable.

> > > Richard



> > > > So all these style of functions are out of my reach?


> > > > > JScript (per ECMAScript specs) does not support ByRef arguments,
> only
> > > > ByVal...

> > > > > Q269258 - INFO: JScript Passes Variables by Value
> > > > > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > > > > --
> > > > > Michael Harris
> > > > > Microsoft.MVP.Scripting
> > > > > --

> > > > > Please do not email questions - post them to the newsgroup
instead.
> > > > > --



> > > > > > I need to call a function exposed by a third party object. The
> > > function
> > > > > > needs two parameters, a String of the command and a String to
> > receive
> > > > the
> > > > > > response, it returns an integer of the success. Code was
> > > > > > var oGWC = new ActiveXObject("xxx.xxx");
> > > > > > var sCommand = "whatever";
> > > > > > var sBuffer
> > > > > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > > > > WScript.echo sBuffer

> > > > > > It always executes correctly according to the iResult but it
never
> > > fills
> > > > in
> > > > > > the sBuffer. I've tried various options on the 'var sBuffer'
line:
> > > > > > var sBuffer = new String();
> > > > > > var sBuffer = new String("");
> > > > > > var sBuffer = new String("              ");
> > > > > > var sBuffer = "";
> > > > > > var sBuffer = "           ";

> > > > > > and no var line at all.
> > > > > > Could anyone help, it's driving me mad, it works fine in VB, but
> not
> > > in
> > > > > > VBScript either.

> > > > > > Joe



Fri, 25 Jul 2003 07:12:36 GMT  
 ByRef?
MeadCo ScriptX control can help here -- for FREE -- serving as thunk:

http://www.meadroid.com/scriptx/docs.htm#InvokeByRef

--
Regards,
Andrew Nosenko,
Senior Software Engineer
Mead & Co Limited

Advanced HTML printing:
http://www.meadroid.com/scriptx/


So all these style of functions are out of my reach?

Quote:
> JScript (per ECMAScript specs) does not support ByRef arguments, only
ByVal...

> Q269258 - INFO: JScript Passes Variables by Value
> http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --




- Show quoted text -

Quote:
> > I need to call a function exposed by a third party object. The function
> > needs two parameters, a String of the command and a String to receive
the
> > response, it returns an integer of the success. Code was
> > var oGWC = new ActiveXObject("xxx.xxx");
> > var sCommand = "whatever";
> > var sBuffer
> > var iResult = oGWC.exec(sCommand, sBuffer);
> > WScript.echo sBuffer

> > It always executes correctly according to the iResult but it never fills
in
> > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > var sBuffer = new String();
> > var sBuffer = new String("");
> > var sBuffer = new String("              ");
> > var sBuffer = "";
> > var sBuffer = "           ";

> > and no var line at all.
> > Could anyone help, it's driving me mad, it works fine in VB, but not in
> > VBScript either.

> > Joe



Fri, 25 Jul 2003 08:52:28 GMT  
 ByRef?
MeadCo ScriptX 5.0 Programming Manual
http://www.meadroid.com/scriptx/docs.htm#byref

ScriptX has methods that allow JScript to call COM methods that take ByRef arguments...

This is part of the "free subset" of ScriptX that does not require a license...

Also, as Richard L. already suggested, you could just use mixed languages in a .wsf and do this part
in a VBScript function that returns the sBuffer back to the JScript caller as the function's return
value.

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> So all these style of functions are out of my reach?


> > JScript (per ECMAScript specs) does not support ByRef arguments, only
> ByVal...

> > Q269258 - INFO: JScript Passes Variables by Value
> > http://support.microsoft.com/support/kb/articles/Q269/2/58.ASP

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup instead.
> > --



> > > I need to call a function exposed by a third party object. The function
> > > needs two parameters, a String of the command and a String to receive
> the
> > > response, it returns an integer of the success. Code was
> > > var oGWC = new ActiveXObject("xxx.xxx");
> > > var sCommand = "whatever";
> > > var sBuffer
> > > var iResult = oGWC.exec(sCommand, sBuffer);
> > > WScript.echo sBuffer

> > > It always executes correctly according to the iResult but it never fills
> in
> > > the sBuffer. I've tried various options on the 'var sBuffer' line:
> > > var sBuffer = new String();
> > > var sBuffer = new String("");
> > > var sBuffer = new String("              ");
> > > var sBuffer = "";
> > > var sBuffer = "           ";

> > > and no var line at all.
> > > Could anyone help, it's driving me mad, it works fine in VB, but not in
> > > VBScript either.

> > > Joe



Fri, 25 Jul 2003 09:16:56 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. ByRef or not ByRef, that is the array?

2. Does VBScript support ByRef and pointers?

3. ByRef and ByVal

4. JScript, Event Interfaces, and ByRef arguments

5. ByRef Parameters in Subs

6. Does ByRef work for anyone?

7. ByRef and ByVal

8. passing ByRef parameters

9. is it posible to use byRef in VBScript?

10. Passing arguments ByRef from VBScript to COMAdmin component

11. ByRef or ByVal or ByWhat?

12. ByRef Supported?

 

 
Powered by phpBB® Forum Software