This is a recurring question on this forum.  One response is this one: (Die
- Prompt - Die! )
https://code.jsoftware.com/wiki/NYCJUG/2015-01-13#Die_-_Prompt_-_Die.21 .
A better answer might be to use the windowing code in J - see
https://code.jsoftware.com/wiki/Scripts/SourceDestDir for a simple example.

As far as triggering something on startup, this might be helpful -
https://code.jsoftware.com/wiki/Guides/Startup - or it may be TMI.  The
short answer is to supply a script to the J session or an inline sequence
of J commands, or both as seen here:

jconsole C:\path\MyConfig.ijs -js "2!:55'' [ wait 1 [ (LF,~":6!:0'')
fappend 'time.out' [ 1!:44'C:\startingPath'"

This runs the"MyConfig.ijs" file then the line of commands in the
double-quotes following "-js" which exits the J session after waiting for a
second after writing a timestamp (6!:0'') to a file after changing to the
"startingPath" directory.

I hope this helps.



On Mon, Apr 27, 2020 at 2:05 PM Anthony O'Malley <[email protected]>
wrote:

> Greetings, All. My first post. A bit lengthy. Sorry.
>
> I am a life-long user of APL who turned to J two years ago and have more
> or less settled into it, long enough to really appreciate its elegance.
> My learning curve has been steep but very pleasurable, and useful.
>
> I have read "Learning J" and all about foreign
> conjunctions (especially, 1!:), but I seem to have missed something.
> None of my APL "quote quad" expertise is related to how a user of a J
> script
> can engage interactively with the script once loaded-- e.g., if the
> script displays 'Please enter
> birthdate', the user inputs, input gets error checked and assigned to a
> variable.
>
> I have a verb USRINPT in the script which uses (1!:2)&2 for prompts and
> (1!:1)1 for user input assigned to a variable. The verb works fine in
> the interpreter when I load the script and execute it myself with
> USRINPT ''.
>
> But, I want the USRINPT verb to execute upon loading the script, so the
> user immediately sees the intro text re proper formation of dates (this
> is fine), then the prompt 'Birthdate?' (this works too) and J returns to
> the left margin awaiting input (this doesn't work).
>
> That is,  when I load the script that has the explicit definition
> USRINPT in it, with next line  USRINPT '' (execute USRINPT), the
> (1!:2)&2 verb in USRINPT displays the prompt, but the assignment of user
> input to variable line n=: (1!:1)1 doesn't happen. It's as though it's
> not there. Of course, since the session has no values for the variables
> supposed to be provided by n=: (1!:1)1, the script eventually shows an
> error, and stops.
>
> I'm not seeing something--about J foreign conjunctions or about scripts
> (J is my first experience of programming with scripts).
> I've looked and looked in the J docs. I would be grateful for a pointer
> in the right direction.
>
> Thanks, Tony
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to