[Jprogramming] GETM / SETM
Oleg Kobchenko
olegykj at yahoo.com
Thu Jul 26 01:05:29 HKT 2007
James,
What I meant is ability to hook up a different
Active Scripting language other than VBScript,
such as JScript, not a .NET framework langauge.
If that's the case, then J (with a little help) could
be hooked up directly to the API without the VBScript
intermediary.
You don't need to worry about Set j=Nothing, as
proper release will happen when the engine shuts
down. It's more for the case of multiple re-use.
--- James Korn <jkorn at jamesakorn.com> wrote:
> Oleg,
>
> Ahhh... (see below). Not that it matters, but now there is nowhere to
> put the "Set j = Nothing" since the script is loaded only once and the
> subroutine may be run many times at user discretion once loaded (I
> wouldn't imagine creating a user initiated subroutine for this!). Yes,
> I use a VBScript engine inside a custom host application. The
> application does have a robust system development environment (SDK) for
> VB.Net and C#, but I currently have neither of these compilers and don't
> think the effort to learn/use them in conjunction with the application
> and J would justify the time spent for what I'm doing right now. And,
> frankly, the VBScript facility is quite capable in its own right and
> with these techniques for moving data back and forth between it and J,
> it should keep me busy for a while longer before I need something more
> powerful.
>
> Thanks again and regards,
> Jim
>
> Option Explicit
>
> Dim j : Set j = CreateObject("JDLLServer")
>
> Sub JSub1
> .
> .
> .
> MsgBox (" $A1" & vbCrLf & DoR("$A1"))
> .
> .
> .
> End Sub
>
> Function DoR(Exp)
> Dim v, r: r = j.DoR(Exp, v)
> DoR = v
> End Function
>
> Oleg Kobchenko wrote:
> > So you use VBScript engine inside a custom host app.
> >
> > If the instance of the engine is shared between sub calls,
> > you can store j in a global variable.
> > If subs can be called in any order, access j from as singleton function GetJ().
> >
> > One of the facilities that pcall by vt-index will allow is
> > calling the host context from J used as
> > Active script engine.
> >
> > Does your app allow to use other scripting language besides VBScript?
> >
> > Oleg Kobchenko
> >
> >
> > On Jul 24, 2007, at 10:48 PM, James Korn <jkorn at jamesakorn.com> wrote:
> >
> > Oleg,
> >
> > Thank you for your notes, I'm working through them. Below is the first example as I've been
> able to get it to work. I encountered a couple of issues:
> >
> > 1) I couldn't get WScript.Echo to work, although it should have (my attempt is commented out
> and includes the variable WshNetwork). I have substituted MsgBox. This issue is of little or
> no significance to me at this point.
> > 2) Since my application requires plug-ins to be subroutines, defining a function outside of it
> (as is necessary) doesn't seem to allow the function to access the j object created by the
> subroutine. Is there a way to pass it?
> >
> > I will report back as I work through the rest.
> >
> > Regards,
> > Jim
> >
> >
> > Option Explicit
> >
> > Sub JSub1
> >
> > Dim r, v, j: Set j = CreateObject("JDLLServer")
> >
> > 'Dim WshNetwork : Set WshNetwork = WScript.CreateObject("WScript.Network")
> >
> > MsgBox "== Example 1 =="
> >
> > Dim A1: A1 = Array(1.1, 1.2, 1.3)
> >
> > ' pass an array
> > r = j.Set("A1", A1)
> >
> > ' see that the array is boxed
> >
> > r = j.DoR("$A1", v): MsgBox(" $A1" & VbCrLf & v)
> > r = j.DoR("A1", v) : MsgBox(" A1" & VbCrLf & v)
> >
> > ' unbox the array
> > j.Do "A2=: >A1"
> >
> > ' see unboxed array
> >
> > r = j.DoR("$A2", v): MsgBox(" $A2" & VbCrLf & v)
> > r = j.DoR("A2", v) : MsgBox(" A2" & VbCrLf & v)
> >
> > ' calc result
> > j.Do "B2=: +/\A2"
> >
> > ' box
> > j.Do "B1=: <""0 B2"
> >
> > ' fetch result
> > Dim B2: r = j.Get("B1", B2)
> >
> > ' print result
> > MsgBox " Result:"
> > MsgBox Join(B2, ",")
> >
> > MsgBox "End"
> >
> > End Sub
> >
> >
> > Oleg Kobchenko wrote:
> > --- James Korn <jkorn at jamesakorn.com> wrote:
> >
> >
> > Thank you for your reply. Three simple but detailed use cases follow. I look forward to your
> reply.
> >
> >
> > I wasn't seeing my response in the Forum so I also posted a Wiki
> > page on VBScript interface:
> >
> > http://www.jsoftware.com/jwiki/Interfaces/VBScript
> >
> > Oleg Kobchenko
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
More information about the Programming
mailing list