Only the console version shows the text before the prompth It does not work in the J7 GTK version
--------------------- prompt=: (1!:1)@1:@(1!:2)&4 prompt 'gtk' |file number error: prompt | prompt'gtk' prompt 'hallo' |file number error: prompt | prompt'hallo' JVERSION Engine: j701/2011-01-10/11:25 Library: 7.01.052 Platform: Win 32 Installer: j701a_win.exe InstallPath: c:/j701 --------------- J Http Server prompt=: (1!:1)@1:@(1!:2)&4 prompt'jhs' hsfgkjshda hsfgkjshda a=. prompt'jhs' 567898 a 567898 JVERSION Engine: j701/2011-01-10/11:25 Library: 7.01.052 Platform: Win 32 Installer: j701a_win.exe InstallPath: c:/j701 ------------- prompt=: (1!:1)@1:@(1!:2)&4 prompt 'J6 ' dff dff a=.prompt 'J6 ' særjgsærejg a særjgsærejg JVERSION Installer: j602a_win.exe Engine: j602/2008-03-03/16:45 Library: 6.02.050 ------------------ prompt=: (1!:1)@1:@(1!:2)&4 prompt 'console' console fdsdfgsd fdsdfgsd a=.prompt 'console' consolesdfhgskdg a sdfhgskdg JVERSION Engine: j701/2011-01-10/11:25 Library: 7.01.052 Platform: Win 32 Installer: j701a_win.exe InstallPath: c:/j701 2012/1/1 bill lam <bbill....@gmail.com> > without wd specific prompt, a jconsole prompt can be simplified to > > prompt=: (1!:1)@1:@(1!:2)&4 > prompt 'foo: ' > foo: bar > bar > > Вск, 01 Янв 2012, Raul Miller писал(а): > > I am not sure this is good advice. > > > > in j6.2, prompt is implemented using 1!:1]1 > > > > in my copy of j7.1, require'misc' does not work and prompt does not > > exist. I do not know how other people are getting it to work in j7.1 > > > > -- > > Raul > > > > > > > > On Sat, Dec 31, 2011 at 9:09 PM, bill lam <bbill....@gmail.com> wrote: > > > From my understanding, 1!1[1 only works under ide session (ijx or > jconsole), > > > but not for standalone scripts. If your applications will always run > inside an > > > ide session I think prompt or 1!:1]1 will both work with minor > difference > > > as you noticed. Just use prompt if you prefer. > > > > > > Сбт, 31 Дек 2011, PackRat писал(а): > > >> bill lam wrote: > > >> > I'm puzzled. If prompt works for you, why 1!:1]1 didn't? > > >> > > >> Just to make sure that all info is known, this is NOT from jconsole, > > >> which I never use. Rather, this is in a J session in .ijx and where > > >> code is developed in .ijs. > > >> > > >> I tried the 1!:1]1 two different ways, using a cover verb (test1 and > > >> test2) and using in-line code (test3): > > >> > > >> -------------------------------------- > > >> require 'files strings' > > >> > > >> > > >> test1=: 3 : 0 > > >> d=. input 'enter something: ' > > >> smoutput < d > > >> ) > > >> > > >> test2=: 3 : 0 > > >> d=. input2 'enter something: ' > > >> smoutput < d > > >> ) > > >> > > >> test3=: 3 : 0 > > >> d=. 'enter something: ' 1!:1 ]1 > > >> smoutput < d > > >> ) > > >> > > >> input=: 3 : 0 > > >> y > > >> entry=. 1!:1 ]1 > > >> ) > > >> > > >> input2=: 3 : 0 > > >> y > > >> 1!:1 ]1 > > >> ) > > >> -------------------------------------- > > >> > > >> > > >> It turns out from further testing that J does NOT hang when using this > > >> approach. It only SEEMED that way because J was actually waiting for > > >> input. Somewhere along the line, I thought I'd try pressing the ENTER > > >> key--and, lo and behold, it seemed to break out of the "hang up" and > > >> returned me to the normal session condition of waiting for a command. > > >> Then I thought, "Maybe it was really waiting for input of some kind", > > >> and so I typed some random letters before pressing the ENTER key. Lo > > >> and behold (again!), it was working and was really waiting for input > > >> all the time. > > >> > > >> The reason I originally didn't pursue this any further is that the > > >> Dictionary misled me (is this a bug in the Dictionary?) when page > > >> dx001.htm clearly stated, "read from the keyboard (does not work > within > > >> a script)". The behavior I described above fit into the Dictionary's > > >> statement (because the seeming misbehaviors were in a script), and so > I > > >> didn't pursue it any further but asked here for alternatives instead. > > >> > > >> So, in answer to your question, bill: yes, it really does work; I just > > >> didn't realize it. Well, almost... > > >> > > >> The reason I didn't realize it is that I thought that (in input and > > >> input2) the literal y would display, and it didn't. By inserting > > >> "smoutput" ahead of the y's, the prompts displayed. With test3, the > > >> first line had to be split in two: the first displaying the prompt > > >> using smoutput, and the second the desired code. Because the prompt > > >> literals didn't display originally, I thought the code wasn't working, > > >> when in fact J was waiting for input. (The reason I thought the > > >> prompts would display in the code at the top of this email is that > > >> single literals usually seem to display in J, and I didn't realize > that > > >> the safest approach apparently is to always use "smoutput" or "1!:2]2" > > >> to display them.) > > >> > > >> The lingering problem with this approach is that, in contrast to the > > >> "prompt" verb, the prompt literal and the user input are on separate > > >> lines--not a good thing. Here's the visual difference, using an > > >> underscore to indicate the location of the cursor: > > >> > > >> Your 1!:1]1 approach: The "prompt" verb: > > >> > > >> This is the data prompt: This is the data prompt: _ > > >> _ > > >> > > >> Or is there some documentation somewhere that indicates how your > > >> approach can be made to look like the "prompt" verb approach? > > >> > > >> I hope this extra information helps explain the situation more > clearly. > > >> > > >> > > >> Harvey > > >> > > >> ---------------------------------------------------------------------- > > >> For information about J forums see > http://www.jsoftware.com/forums.htm > > > > > > -- > > > regards, > > > ==================================================== > > > GPG key 1024D/4434BAB3 2008-08-24 > > > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm