Here is a prototype for J as Scripting Language for Windows script hosts: cscript/wscript shell with .ijss extension or a Windows Script File job, ASP, Internet Explorer; as well as custom applications that support scripting extensions.
http://www.jsoftware.com/jwiki/Interfaces/Jay_Script http://olegykj.sourceforge.net/ (for download) It requires the latest general/pcall addon from JAL. JayScript name may kind of confusing, so what are better names? Maybe JPLScript or JLScript? (The Script suffix is essential, cf PerlScript, etc). --- Oleg Kobchenko <[EMAIL PROTECTED]> wrote: > James, > > The support for Scripting languages should be generic, > the same as in Internet Explorer, ASP, Windows Script Component, > or Windows Shell (cscript.exe/wscript.exe which the > examples were intended for). > > The particular languages is recognized either by file > extension or an explicit moniker, like > <script language="vbscript">... > That's how ActiveState allows to use perl and python > with all those Windows script hosts. > > So if you could try to make the app recognize a > simple JScript file, chances are, J could be hooked > up too. > > > > > > > > Oleg Kobchenko wrote: > > >> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 ____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
