David, I should have figured it out myself to look into the object browser. At this point I was too focused on the J help.
Thanks a lot. Thats very helpful. Mit freundlichen Grüßen / Kind regards, Martin Bartsch Talanx AG KQR Riethorst 2 30659 Hannover phone +49 511 3747-2460 fax +49 511 3747-2460 mailto:[email protected] www.talanx.com Information according to Section 80 of the German Corporation Act Address: Talanx AG, Riethorst 2, 30659 Hannover Supervisory Board: Wolf-Dieter Baumgartl (Chairman) Executive Board: Herbert K. Haas (Chairman), Dr. Christian Hinsch (Deputy Chairman), Norbert Kox, Dr. Thomas Noth, Dr. Immo Querner, Dr. Heinz-Peter Roß, Ulrich Wallin Registered Office: HR Hannover B 52546 -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von David Mitchell Gesendet: Freitag, 16. April 2010 20:14 An: Programming forum Betreff: Re: [Jprogramming] Re : Strange behaviour in J OLE Server for Excel Martin, My example would be better with Status = jObject.Do("a=.'hello world'") Here is the information from the Excel Object Browser. It is not complete documentation. --- Function Break() As Long Member of JDLLServerLib.JDLLServer Break (interrupt) J execution. Function Clear() As Long Member of JDLLServerLib.JDLLServer Clear all J memory allocations. Erases all J variables and definitions. Function Do(input As String) As Long Member of JDLLServerLib.JDLLServer Execute string. Function DoR(input As String, v) As Long Member of JDLLServerLib.JDLLServer Execute string and return formatted output in BSTR. Function ErrorText(error As Long, v) As Long Member of JDLLServerLib.JDLLServer Get variant with error code text. Function ErrorTextB(error As Long, v) As Long Member of JDLLServerLib.JDLLServer Get variant BSTR with error code text. Function ErrorTextM(error As Long, text As Long) As Long Member of JDLLServerLib.JDLLServer Get memory address of error code text. Function Get(jname As String, v) As Long Member of JDLLServerLib.JDLLServer Get variant value from J variable. Function GetB(jname As String, v) As Long Member of JDLLServerLib.JDLLServer Get variant value from J variable (BSTR). Function GetM(jname As String, jtype As Long, jrank As Long, jshape As Long, jdata As Long) As Long Member of JDLLServerLib.JDLLServer Get J variable description and memory addresses of shape and data. Function IsBusy() As Long Member of JDLLServerLib.JDLLServer Returns 0 if ready to execute a line, or an error code if not ready. Function Log(b As Long) As Long Member of JDLLServerLib.JDLLServer Display (1) or discard (0) J EXE Server session manager input and output. Function Quit() As Long Member of JDLLServerLib.JDLLServer Quit causes J EXE Server to close when last object is released. Function Set(jname As String, v) As Long Member of JDLLServerLib.JDLLServer Set variant value in J variable. Function SetB(jname As String, v) As Long Member of JDLLServerLib.JDLLServer Set variant value in J variable (BSTR). Function SetM(jname As String, jtype As Long, jrank As Long, jshape As Long, jdata As Long) As Long Member of JDLLServerLib.JDLLServer Set J variable from description and memory addresses of shape and data. Function Show(b As Long) As Long Member of JDLLServerLib.JDLLServer Show (1) or hide (0) J EXE Server. Function Transpose(b As Long) As Long Member of JDLLServerLib.JDLLServer Enable/disable (1/0) row-major(variant)/row-minor(J) conversions. -- David Mitchell On 4/16/2010 12:57, Bartsch, Martin wrote: > Hello all, > > Because of a workshop, I was offline for two days. > So, I have to apologise for giving this response a little bit late. > > @David : Your solution is most helpful. It works very well. - Thank > you very much. > > @Chistoph : replacing line 3 with js.getb("a",x) gives a "type > mismatch"-error on my machine ("Typen unverträglich") > > @Richard : I cannot find the article "Using J in Excel". A search on the > wiki-page gives me no results. > The documentation I am working on is "J OLE Server for Excel", "J > OLE Automation Server" and the textfiles > from the examples/ole/excel-directory. > > @Bill : replacing a=. with a=: makes no difference on my machine. > > > I was not aware of the Jserver-Methods DoR and GetB. They are not > documented in the J OLE Automation Server-documentation. Is there any > complete documentation on the J server methods ? > > Once again, thanks to all of you. > > Cheers, > > Martin > > > P.S. : I cannot find a respond-button on the forum-pages. So I just set the > digestmode to off and hope to follow the treestructure of the thread next > time. > But have the feeling that this will once again start a new > thread. Sorry for that. > > > > > > > >>> Hello, >>> >>> I´m going to use the J OLE Server for Excel in one project. This >>> seems to me a great solution where everyone wants to use excel and I >>> want to develop the software in my language of choice J. >>> >>> So far I have one issue with getting strings out of J into >>> Excel-VBA. The following example gives two different values for x >>> ("?????") and a ("hello world"). >>> >>> 1 Sub jserver_issue() >>> 2 ec = js.do("a=.'hello world'") >>> 3 ec = js.get("a", x) >>> 4 MsgBox x >>> 5 ec = js.do("wdinfo a") >>> 6 End Sub >>> >>> Is this a normal / expected behaviour ? >>> Has anyone found the same issue or am I doing something wrong ? >>> >>> Thanks for help, >>> >>> Martin >> >> This works for me: >> >> Sub Main() >> Dim jObject As New JDLLServerLib.JDLLServer >> Dim rObject As Variant >> >> Status = jObject.DoR("a=.'hello world'", rObject) >> Status = jObject.DoR("a", rObject) >> MsgBox ("J Local Assignment:"& Str(Status)& " and result"& >> vbCrLf& >> rObject) >> Status = jObject.DoR("a=:'hello world'", rObject) >> Status = jObject.DoR("a", rObject) >> MsgBox ("J Global Assignment:"& Str(Status)& " and result"& >> vbCrLf& >> rObject) >> >> Status = jObject.DoR(">(4 8 i.3!:0<.2^33){'Got J64';'Got J32'", >> rObject) >> MsgBox ("J DoR ended with status"& Str(Status)& " and >> result"& vbCrLf& rObject) >> jObject.Quit >> End Sub >> >> -- >> David Mitchell > > > > > Cheers > > > Martin > > > ---------------------------------------------------------------------- > 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
