Going home in a few minutes and sat back when I remembered you question.

For example, you have a script file: c:\foo.ijs

NB. START OF FILE
foo=: verb define
temp=. i. 5 5
smoutput temp
data=. ": {: "1 temp
data fwrite 'c:\test.txt'
)

NB. You should put this here to "auto-execute" the foo verb
NB. this is a bit of a trick, there are others like 
NB. setting ARGV_z_ to a set of values and reference that
foo ''
NB. END OF FILE

So when you do the following in C#:
        var session = new Session();
        session.Load("c:\foo.ijs");

The file: C:\test.txt will be created.



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mark Needham
Sent: Friday, July 09, 2010 8:15 PM
To: Programming forum
Subject: Re: [Jprogramming] Getting J to work with .NET

Cool! I changed it a little to work in C#:

            var session = new Session();
            session.Eval("result=: 2 + 2");
            var result = session.Variable("result");
            Console.Write(result);

What would I need to do if I wanted to execute a J script file directly rather 
than just individual expressions?

On 9 July 2010 12:20, Alex Rufon <[email protected]> wrote:

> To get the result.
>
> Session Obj = new Session();
> Obj.Eval("result=: 2 + 2");
> Int result = 0;
> Obj.Variable("result",result);
>
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Mark Needham
> Sent: Friday, July 09, 2010 6:51 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Getting J to work with .NET
>
> Ah cool, thanks.
>
> So then if I've follow the instructions from there it should be 
> possible to execute some J by doing the following (in C#)
>
> new Session().Eval("2 + 2")
>
> ?
>
> I tried that but I wasn't really sure what I need to do to get the 
> result from that evaluation. Am I going about this the wrong way?
>
> Cheers, Mark
>
> On 9 July 2010 10:03, Alex Rufon <[email protected]> wrote:
>
> > Hi Mark,
> >
> > I wrote that guide for J601a and it will fail miserably if you're 
> > using J602.
> >
> > Please refer to http://www.jsoftware.com/jwiki/Guides/J%20VB.NET for 
> > more information.
> >
> > r/Alex
> >
> > -----Original Message-----
> > From: [email protected] [mailto:
> > [email protected]] On Behalf Of Mark Needham
> > Sent: Friday, July 09, 2010 3:44 PM
> > To: [email protected]
> > Subject: [Jprogramming] Getting J to work with .NET
> >
> > I've been following the guide to try and get J to work with C# - 
> > http://www.jsoftware.com/jwiki/Guides/J%20CSharp - but trying out 
> > the included demo app I can't find the 'JExeServerLib' dll.
> >
> > It shows as an unfound reference in Visual Studio and I don't see it 
> > on the COM list of dlls.
> >
> > Any ideas?
> >
> > Thanks, Mark
> > --------------------------------------------------------------------
> > -- For information about J forums see 
> > http://www.jsoftware.com/forums.htm
> > --------------------------------------------------------------------
> > -- For information about J forums see 
> > http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to